HerokuRichard SchneemanExplainer
Upgrade to Puma 7 and Unlock the Power of Fair Scheduled Keep-alive
Summary
Puma 6 and earlier could let a keep-alive connection “cut the line” when all threads were busy, allowing up to ten requests from that connection to run consecutively while previously accepted work waited. The behavior came from reusing a “fast inline” optimization intended for HTTP pipelining, where requests arrive together, for keep-alive requests that can arrive later. Puma 7 changes queueing so pipelined and keep-alive requests return to the back of the queue, and adjusts wait_until_not_full so interleaving is possible; its accept loop now slows proportionally with load instead of stopping completely. The fix does not add capacity, but distributes overload delay more fairly across requests. The post recommends upgrading to Puma 7.1.0 or later, especially for applications that had disabled keep-alives after latency spikes.
Context
When Puma is overloaded and all threads are busy, Puma 6 and earlier can allow a keep-alive connection to monopolize a thread for up to ten requests, causing other requests to experience substantially higher latency. The behavior originated from an optimization designed for HTTP pipelining and becomes especially relevant during bursts or when web capacity needs to be scaled.
Approach / What changed
Puma 7 changes request queueing so pipelined and keep-alive requests are placed behind previously accepted work, and adjusts wait_until_not_full to permit interleaving. Its accept loop no longer fully blocks when workers are busy; it slows down in proportion to system load. Puma 7.0 disabled keep-alive fast inline behavior, while Puma 7.1.0 reintroduced it with a safeguard for fairness under overload.
Takeaways
Puma 6 and earlier could process up to ten requests from one keep-alive connection consecutively, allowing them to bypass previously accepted requests.
Puma 7’s fairness changes make new keep-alive and pipelined requests wait their turn, while the accept loop slows proportionally instead of stopping completely.
The fix does not increase request capacity; under overload, it distributes processing delay more evenly. Applications are recommended to upgrade to Puma 7.1.0 or later.
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.