a month ago
TLDR: using the internal pg host induced a 100ms penalty on queries compared to the external host.
I recently set up a PG Bouncer template instance and noticed weird query duration behavior when using it. Whenever I would load it up with several medium-sized queries it would tack on an additional 100-120ms latency per query, even for smaller 'SELECT 1' queries I ran after. I ended up diagnosing the issue as just to do with the internal TCP connection between the bouncer instance and my Postgres HA cluster. As soon as I switched the bouncer database host from the Postgres HA internal host to the external one (incurring extra egress costs) I noticed the problem go away instantly. All instances that are interacting are in US East region, so there is no cross-region penalty.
Given that I have solved this for my own use case and the egress costs are not currently a concern, I don't need immediate attention on this. However I consider this to be pretty concerning that internal networking is slower than external and wanted to open a ticket to eventually having this fixed.
2 Replies
Status changed to Awaiting Railway Response Railway • about 1 month ago
a month ago
Thanks for the detailed report, we'll track the issue as a data point for the networking team. One thing worth checking: if your environment was created before October 16, 2025, it uses IPv6-only private networking, which can compound this issue. Creating a new environment would give you dual-stack (IPv4/IPv6) private networking and may reduce the latency.
Status changed to Awaiting User Response Railway • about 1 month ago
a month ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • about 1 month ago
a month ago
Hi, sorry for the no reply I didn't see a notification for this response. It was created in 2026 so no concern about IPv6 only networking. I'm actually also experiencing this with another service besides PG Bouncer. I have a Go service running in a container that was connecting to the database URL via internal networking, and was incurring a 100-135ms penalty per query for cross-region and several ms per query for in-region. Now that I'm using external networking I see a significantly reduced penalty for cross-region (upwards of 80ms from limited data collection), and a slightly reduced penalty for same-region as well.
I would really love to be able to provide any more information for debugging or identifying the issue. I am happy to collect any data internal to our services to support identifying this issue.
Thanks again for your time and support!
Status changed to Awaiting Railway Response Railway • 29 days ago
a month ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • 29 days ago