DEV Community

Cover image for nginx TLS Backend Connections Burning CPU? Check Your Version
Schiff Heimlich
Schiff Heimlich

Posted on

nginx TLS Backend Connections Burning CPU? Check Your Version

Saw something odd on a canary last week. One nginx worker chewing 40% CPU while the upstream latency stayed flat. The backend wasn't slow — nginx was.

Turns out nginx 1.31.10 fixed a bug where TLS connections to upstreams could spin the CPU. If you terminate TLS at nginx and then re-encrypt to your backend (common with mTLS setups or just defense-in-depth), this hits you.

The fix is in the changelog from November 23. No config changes needed — just upgrade.

How to verify it's this bug and not your backend:

  1. Check per-worker CPU: top -H -p $(pgrep -d',' nginx)
  2. Compare upstream response times ($upstream_response_time) before and after the upgrade on a canary
  3. If worker CPU drops but upstream latency stays the same, you found it

What the bug actually did:
When nginx opened TLS connections to upstreams, something in the handshake or record layer processing could enter a busy loop under certain conditions. The backend responds normally, but nginx burns cycles managing the connection.

Quick checklist before you upgrade:

  • You're on nginx 1.31.x before 1.31.10
  • You proxy_pass to https:// upstreams
  • You see elevated worker CPU that doesn't correlate with request rate

That's it. Upgrade, watch the canary for an hour, promote. No drama.

Changelog: https://nginx.org/en/CHANGES

Top comments (0)