Connection reset by peer when connecting from Northern Europe
Specifically one of the software we run, Ory Keto, gets this error multiple times per day, which makes a few support tickets each day. Our project is setup to always be on at .25 CUs and runs in Azure Germany West Central (Frankfurt). It has almost no traffic, but the symptoms is as if it's not always on and has connection issues whenever the first connection in a while happens.
It looks like we get scaled to 0, perhaps it's the connection pooler? This does not happen at all with a locally setup PG17 instance.
The error we get is specifically:

5 Replies
flat-fuchsiaOP•7mo ago
This is becoming a major problem and I feel somewhat helpless. Perhaps it's the connection pooling?
distinguished-blush•7mo ago
Given that this happens on the first connection, it may be the result of your compute scaling to zero when not in use. The first connection will always have a little higher latency than subsequent connections.
This topic deals with latency issues: https://neon.tech/docs/connect/connection-latency
Some things that could help:
- Setting a higher connection timeout
- Ensuring you have a connection retry mechanism enabled or built into your app
-Making sure your database is in the same region as your application to reduce latency
- Disabling scale to zero (you can do this on a paid plan). However, it sounds like this database is not active all the time, so scale-to-zero would be quite beneficial.
Also, if you're on a paid plan, I suggest opening a support ticket to take advantage of their expertise: https://console.neon.tech/app/projects?modal=support
Neon
Connection latency and timeouts - Neon Docs
Neon's Scale to zero feature is designed to minimize costs by automatically scaling a compute resource down to zero after a period of inactivity. By default, Neon scales a compute to zero after 5 mi...
flat-fuchsiaOP•7mo ago
It has scale-to-zero disabled, so it's not that. Also connection reset by peer isn't caused by timeout afaik, so it's not that either.
I'll open a ticket instead then 🙂 Thank you!
other-emerald•7mo ago
@Bittermandel Can you report back when you figure it out? I'm having the same issues although I'm on a free plan, but maybe the solution is the same. If possible, @ me
flat-fuchsiaOP•7mo ago
Will do 👍