Slow database access through Tailscale VPN
brilliant-almazov
PROOP

2 months ago

Hi Railway team,

I'm experiencing significant slowness when accessing my PostgreSQL database through Tailscale VPN from Navicat on my local machine. Queries and data retrieval are noticeably slow — it's uncomfortable to work with.

Inside the Railway environment itself, the database works fine with no issues.

Details:

Connection method: Tailscale VPN

Database: PostgreSQL

Client: Navicat (local machine)

Connection string: postgres.railway.internal

The database is working normally — the issue is specifically with remote access through Tailscale. Can you help optimize this connection or suggest alternative solutions?

2 Replies

dkoo761
PRO

2 months ago

I have the same issue.

Our friend Claude Code had some insights after some analysis:

--------------------

  1. Userspace networking — all packets processed in userspace, not kernel
  2. DERP relay fallback — traffic bouncing through Tailscale's relay servers instead of going direct
  3. Small UDP buffers + low MTU — container restrictions

3a) UDP buffer sizes are restricted:

failed to force-set UDP read buffer size to 7340032: operation not permitted

failed to force-set UDP write buffer size to 7340032: operation not permitted

The kernel defaults are much smaller, which directly impacts WireGuard throughput.

3b) MTU is 1360

Lower MTU means more packets for the same data, adding overhead.

Unfortunately, both of these are Railway container restrictions — you can't change kernel UDP buffer sizes or MTU settings without elevated privileges.

--------------------

@railway Is there anything that can be done about this? My current throughput is limited to about 0.5Mbit/s when using Tailscale.


ibadus
PRO

a month ago

Facing the same issue


Welcome!

Sign in to your Railway account to join the conversation.

Loading...