N
Neon15mo ago
adverse-sapphire

High, inconsistent query latency in warm node from same region

I'm testing a project on Neon cloud (tiny-sky-56601552) in eu-central-1 and connecting from the same region, but get 40-60ms latency for simple queries. The latency should be single digit milliseconds as my queries are simple: insert into .. returning id or update .. where returning id, revision, etc. But I'm observing most queries take around 40-60ms to complete, with a few lucky ones randomly much faster at ~5ms (as it should be). This kills performance when executing even just a couple queries per request. Any ideas?
6 Replies
eastern-cyan
eastern-cyan15mo ago
What driver are you using? Can you share the relevant query code?
adverse-sapphire
adverse-sapphireOP15mo ago
The driver is psycopg3, the queries are varied, but they really are just of the form: update table1 set column = 2 returning id Notably the same queries are fine sometimes, and they're always fine with other Postgres installations (local Postgres, TimescaleDB, RDS)
adverse-sapphire
adverse-sapphireOP15mo ago
Here's a representative trace:
No description
adverse-sapphire
adverse-sapphireOP15mo ago
Both queries insert one row each (nearly identical), one query takes ~4ms, the other ~40ms. Unfortunately, most take >40ms. Do you have any profiling on your side to see what's causing the lag? Neon is mostly a black box as a user (the monitoring dashboard doesn't even track latency)
genetic-orange
genetic-orange15mo ago
Hey @Florian, Can you share your code?
adverse-sapphire
adverse-sapphireOP15mo ago
No, there’s nothing exciting about it though. It really is just that query with psycopg3

Did you find this page helpful?