Skip to catalogue

204

keep-alive

Reuse the TCP connection for the next request. Closing it every time repeats the handshake.

What is keep-alive?

HTTP keep-alive leaves the connection open for another request. Idle connections still consume a file descriptor. A client that opens keep-alives and never reuses them just holds sockets. Servers close idle ones after a timeout. The two timeouts should agree.

Why does keep-alive matter when vibe coding?

Models create a new client per call, or they set keep-alive and a server idle timeout that is shorter, so every “reused” connection is already dead and the first request fails.

How do you do keep-alive?

One client, keep-alive on, idle timeout below the server’s. Cap idle connections. Do not disable keep-alive to “fix” a stale socket — fix the timeout mismatch.

How do you ask a model for keep-alive?

Reuse connections to (host) with keep-alive. One client, not one per request. Set the idle timeout below the server’s. Cap the pool. Do not disable keep-alive as the fix for stale sockets.

What goes wrong with keep-alive?

A keep-alive pool per request scope that is discarded. You built a pool and threw it away. The pool has to outlive the request.

adjacent