HerokuRichard SchneemanTutorial
Learn How to Lower Heroku Dyno Latency through Persistent Connections (Keep-alive)
Summary
Repeatedly opening TCP connections between the Heroku Router and an application dyno can impose TCP slow start on every request, creating a latency penalty. The post explains how HTTP/1.0 tied each request to a new connection, while HTTP/1.1 keep-alive connections reuse an open connection and amortize setup overhead; unlike pipelining, they do not require requests to be prepared in advance. Heroku Router 2.0 uses keep-alive connections to dynos by default, avoiding repeated slow-start costs on repeat requests and exposing more available bandwidth and lower latency. Ruby applications that previously disabled keep-alives are directed to upgrade to Puma 7.1.0 or newer, then update the bundle, inspect settings, and deploy. Keep-alives still depend on both Puma and router configuration, and the post notes that the router also supports HTTP/2 features.
Context
Each new request previously risked paying the TCP slow start cost because connections between the Heroku Router and application dynos were repeatedly opened. The post frames this as a latency penalty for applications making repeated requests.
Approach / What changed
Heroku Router 2.0 enables keep-alive connections to dynos by default. Ruby applications are instructed to upgrade to Puma 7.1.0 or newer if they disabled keep-alives, update the dependency, inspect Puma and router settings, and deploy.
Takeaways
HTTP/1.1 keep-alive connections reuse an existing TCP connection, avoiding the connection-start portion of TCP slow start for later requests.
Heroku Router 2.0 uses keep-alive connections to dynos by default, but Puma and router configuration can still disable them.
The upgrade path for affected Ruby applications is Puma 7.1.0+, followed by bundle updates, configuration checks, and deployment.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.