48-Hour Field Notes: curl Looked Instant. Python Paid a Handshake on Every Call.
I spent forty-eight hours arguing with an API that was not actually slow on the wire. My Python probe kept printing extra delay, while a single curl call still looked almost instant. Have you ever trusted a client-side timer and then shipped a performance scare that never existed upstream? The disagreement showed up during a quiet check, not during an incident bridge or a customer ticket. I had a…
The author spent forty-eight hours investigating an API that appeared slow when measured through Python, despite appearing fast when accessed via curl. Both tools showed different performance when calling the same health endpoint. The issue was traced to the Python script's handling of HTTP connections, which opened a fresh TCP connection and TLS session on each request, incurring significant overhead.
This behavior was not inherent to Python but rather a client-side issue that was not evident during initial measurements. The root cause was the lack of connection reuse in the Python code, causing each iteration to incur the full cost of a new handshake. The author resolved the issue by implementing connection reuse, which significantly reduced the observed latency and demonstrated the importance of considering client-side lifetimes in performance measurements.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.