Postgres-js Distributed Performance
Couple of questions:
- Why
prepare: false
- ? (that's going to slow things down!)
- Don't define timeouts or lifetimes.
- Have you tried the pg
driver? We've noticed issues with Postgres.js and working with the maintainer to figure out why3 Replies
Just tried both without the connection settings and with
- without the connection settings from the TH region I'm seeing ~1000ms
- with the connection settings I'm seeing ~500ms
Also I'm not sure if the 2nd request is supposed to get a cache hit, but sometimes I'm seeing it as slow as the first one
Here is an example log
This is with prepared: true and no connection settings
And this is with a Berlin VPN (with prepared false and the connection settings)
POST my-url - Ok @ 3/22/2024, 9:27:47 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 2571ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:27:50 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 516ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:27:59 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 555ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:28:00 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 500ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:27:47 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 2571ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:27:50 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 516ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:27:59 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 555ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:28:00 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 500ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:00 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 3564ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:06 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 2532ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:09 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1249ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:11 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1511ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:13 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1827ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:16 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1268ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:00 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 3564ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:06 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 2532ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:09 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1249ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:11 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1511ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:13 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1827ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:32:16 PM
(log) Request received from TH
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 1268ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:32 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 70ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:33 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 13ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:35 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 10ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:35 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 19ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:36 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 15ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:32 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 70ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:33 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 13ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:35 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 10ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:35 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 19ms
(log) Terminating database client.
POST my-url - Ok @ 3/22/2024, 9:35:36 PM
(log) Request received from DE
(log) HELLO THERE
(log) getUserFromRequest executed in 0ms
(log) Initialized database client
(log) Query: select "id" from "User" "user" limit $1 -- params: [10]
(log) Executed resolver in 15ms
(log) Terminating database client.
What’s your hyperdrive ID? And account ID? (Both are safe to post publicly)
Sorry I missed your message:
accountId : e32ef9fa893998106c15705a6de29139
hyperdriveId: b381ec9a8f284249b85d2a414fa2e347