HTTP/2 connection drops after 60s despite keep-alive - configurable?

jetsonearth
FREE

3 days ago

Hey Railway team! 👋

Quick question about HTTP/2 connection persistence limits on Railway.

Context:
I have a Swift client that sends keep-alive requests every 40s to maintain HTTP/2 connections to my Railway-hosted proxy (which forwards to Groq API). This works great for eliminating cold start penalties.

Issue:
Connection reuse works perfectly for ~60 seconds, then Railway seems to drop the connection despite active keep-alives every 40s. This causes 800ms+ TCP/TLS handshake penalties.

Question:
Is there a way to extend HTTP/2 connection persistence beyond 60 seconds on Railway? Or is 60s a hard limit?

My keep-alive setup:
Connection: keep-alive + Keep-Alive: timeout=55 headers
URLSession with persistent config (httpMaximumConnectionsPerHost = 1)

Project ID: 77c31c97-2ba9-4511-b060-7ff5fa441682

$10 Bounty

1 Replies

3 days ago

Hello,

We do not support HTTP/2. HTTP/2 is accepted, but it is demuxed down to HTTP/1.1 when our proxy connects to your application.


jetsonearth
FREE

3 days ago

Thanks Brody, how do I enable persistent connection beyond 60s?

Sorry I am super new to deploying app so might be some dumb questions

I use Groq in production. I'm deploying the proxy on Railway and embedding my Groq LLM API key into the proxy so my client application can request through my proxy. I've noticed it's hard to keep the connection longer than 60 seconds. Sending "Keep Alive" doesn't keep it. Is there any way to work around this?


jetsonearth
FREE

3 days ago

My TCP/TLS latency are quite high

(base) ZhaobangJetWu (main *) ~
$ curl -w @- -o /dev/null -s "https://clio-backend-production.up.railway.app/" <<<'timenamelookup: %{timenamelookup}\ntimeconnect: %{timeconnect}\ntimeappconnect: %{timeappconnect}\ntimetotal: %{timetotal}\n'
timenamelookup: 0.778054 timeconnect: 0.779268
timeappconnect: 1.415058 timetotal: 1.507795

(base) ZhaobangJetWu (main *) ~
$ curl -w @- -o /dev/null -s "https://clio-backend-production.up.railway.app/" <<<'timenamelookup: %{timenamelookup}\ntimeconnect: %{timeconnect}\ntimeappconnect: %{timeappconnect}\ntimetotal: %{timetotal}\n'
timenamelookup: 0.005307 timeconnect: 0.008736
timeappconnect: 0.630628 timetotal: 0.718160
(base) ZhaobangJetWu (main *) ~

$ curl -w @- -o /dev/null -s "https://clio-backend-production.up.railway.app/" <<<'timenamelookup: %{timenamelookup}\ntimeconnect: %{timeconnect}\ntimeappconnect: %{timeappconnect}\ntimetotal: %{timetotal}\n'
timenamelookup: 0.003124 timeconnect: 0.004879
timeappconnect: 0.621428 timetotal: 0.701561
(base) ZhaobangJetWu (main *) ~
$


3 days ago

On our side, we allow for persistent connections for up to a maximum of 15 minutes, so anything stopping your connections at a timeframe shorter than that would be something on your side.

I will go ahead and place a bounty on this thread in hopes that the community can help you debug where you have this 60-second timeout set.


phoenixauro
HOBBYTop 10% Contributor

3 days ago

Try using a vpn.

keep-alives only tell the server what you prefer. Instead maybe you can send an actual light weight request to keep it alive.