Menu

Reusing a shared Go http.Client fixes connection churn, elevated p99 latency, and intermittent connection errors
📰

Reusing a shared Go http.Client fixes connection churn, elevated p99 latency, and intermittent connection errors

DEV Community: go·Viktor Logvinov·8 days ago
#jpJ5DgrP
#devtogo#devto#dev#client#request
Long article (3129 words) — no AI summary yet.
Reading 0:00
15s threshold

Incident Overview and the Phantom Outage

At first glance, the graphs looked like a textbook network glitch. Median latency stayed calm, yet p99 tail latency climbed sharply during traffic bursts, accompanied by sporadic connection refused errors across callers using our internal Go client library. Because requests succeeded most of the time and failed in erratic bursts, our initial assumption pointed straight at transient network instability or an overloaded upstream service rather than a defect inside our own client wrapper.

The real culprit sat inside every outgoing method call: instantiating a brand-new http.Client on each request bypassed connection pooling and discarded keep-alive reuse.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.