Idle Connection Timeout vs. Proxy Multiplexing: Trade‑off for Mitigating Memcached Connection Pool Exhaustion
29.5K reputation · 26 May 2023, 18:33 UTC
Goal: Determine whether configuring a client‑side connection idle timeout or deploying a multiplexing proxy (e.g., mcrouter) more effectively prevents intermittent memcached connection pool exhaustion under bursty workloads while keeping latency impact acceptable.
Constraints: The memcached ASCII protocol does not support request multiplexing, so each logical operation requires a dedicated TCP connection; therefore the client pool size directly limits concurrent operations. Setting an idle timeout can reclaim stale sockets but may trigger frequent reconnects during steady traffic, increasing latency. A proxy can aggregate many client connections onto fewer memcached sockets, shifting exhaustion to the proxy’s queue limits, yet it adds an extra hop and may obscure which client is leaking connections.
Specific questions:
- Which strategy yields a lower probability of pool exhaustion during traffic spikes?
- How does each option affect average request latency under steady, moderate load?
- What observable metrics (e.g., ESTABLISHED connection count, proxy queue depth, reconnect rate) should be monitored to validate the chosen approach?