Urgent.News

What's breaking now, across thousands of outlets.

Tech

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.

Read the original at dev.to →

More in Tech

I built a browser extension to show pixel diffs in GitHub PRs

I've been using AI to write more code, which has also meant writing more tests—including screenshot tests to catch unexpected UI changes.

  • Software developer created gh-pixel-diff extension for GitHub PRs.
  • Extension adds pixel diff functionality within PRs without installation.
  • Users can save comparison views as PNG files for review comments.

More from Tuesday 22 September →