#connection-pool
Posts
-
Digging into nginx's Source 12: Load Balancing, Upstream Keepalive and the Stream Module — and Wrapping Up the Series
When an upstream {} block lists several servers, how does nginx pick one for each request? We trace the load-balancing frame built from three function pointers (peer.init, get, free), the smooth weighted round robin that spreads weights 5:1:1 as a a b a c a a, max_fails and fail_timeout, the keepalive module that wraps get/free to park connections in a cache (on by default in this version, even if you never write it), and the stream module that puts the same foundation under plain TCP — checked against the source and Docker examples — and then wrap up the series.
-
Digging into Apache httpd's Source 14: mod_proxy — Reverse Proxy and Load Balancer
We follow one ProxyPass line through the source until the request reaches another server. We see where the URL turns into a "proxy:..." r->filename, how proxy_handler() hands the work to the scheme handler hook, the worker and connection pool that each backend gets, how mod_proxy_http streams the response back through brigades, and how the byrequests balancer alternates between two backends — checked with two backends running in a container.