HerokuFred HebertIncident / postmortem
How We Sped up SNI TLS Handshakes by 5x
Summary
Heroku’s SNI TLS termination work exposed severe handshake performance problems under benchmarks designed to avoid session resumption, caching, and keep-alive reuse. Initial tests made nodes slow and unresponsive 7–8x earlier than comparable HTTP tests, while perf top showed Erlang garbage collection and ETS hash operations consuming unexpectedly large amounts of CPU. Tracing linked repeated ets.select_delete calls to the centralized ssl_manager process, where ssl_pkix_db’s certificate cache path was still used even for DER certificates supplied directly in memory. Engineers patched the SSL library to bypass that cache wholesale. Each instance then handled three times the benchmark capacity, while SNI latencies fell from 100–120 milliseconds to 20–25 milliseconds for the reported app subset; the patch was later shipped in Erlang/OTP-19.1.
Context
Beta customers reported poor SSL performance, and benchmarks showed nodes becoming slow and unresponsive 7–8 times earlier than under comparable HTTP tests. The investigation also aimed to determine how many routing instances would be needed as more traffic shifted from simple HTTP to HTTP plus TLS.
Approach / What changed
The investigation used deliberately handshake-heavy benchmarks, perf top, and Erlang tracing. It identified ets.select_delete calls from ssl_manager and traced them to ssl_pkix_db’s certificate cache path, which was unnecessary for DER certificates supplied in memory. A patch bypassed that cache wholesale, was tested on canary nodes, and was deployed across the platform before being sent upstream to OTP.
Takeaways
Handshake-focused benchmarks disabled session resumption, caching, and keep-alive reuse while using very small HTTP requests to make handshake cost dominate.
perf top and Erlang tracing identified ETS hash work and garbage collection around ssl_manager as the bottleneck, rather than cryptographic processing in libcrypto.so.
Bypassing the certificate cache tripled benchmark capacity and reduced reported SNI latency from 100–120 ms to 20–25 ms; the change shipped in Erlang/OTP-19.1.
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.