Skip to main content

Module pool

Module pool 

Source
Expand description

Bounded idle-TCP-connection pool against 127.0.0.1:<port>.

Reduces socket() + connect() overhead per inbound stream by reusing keep-alive connections to the local origin. Each pooled entry carries a release timestamp; entries older than idle_ttl are reaped on acquire so we never hand back a connection the origin has already half-closed by idle timeout.

The pool only stores connections that are known to be in a healthy “ready for next request” state — the proxy must call Pool::release only after fully reading a response whose framing it understood (Content-Length-bounded).

Structs§

Pool

Constants§

DEFAULT_IDLE_TTL
Idle socket TTL — most servers (e.g. axum, hyper, nginx) idle out keep-alive connections at 60-75s; 30s gives us a safe buffer and matches the typical client-side default.
DEFAULT_MAX_IDLE
Soft cap on idle sockets per pool. Beyond this we drop the freshly-released socket on the floor; the next acquire will open a new one if needed.