Connection pooling is a performance-enhancing feature that helps reduce the overhead of managing persistent connections between client and server. This feature has the load balancer keep connections to backend servers open after a request is complete and reuse them for future requests (only opening more if all the currently open connections are in use). This lets applications process a greater number of incoming requests without exhausting available memory, CPU, or network bandwidth.

What makes connection pooling useful?

While opening and closing individual connections isn't necessarily "expensive" nor time consuming, things quickly change at scale (especially if the connections between load balancer and backends are secured via TLS). Whether you're connecting to a server or database, drawing from a pool of open connections helps your application support concurrent operations without a noticeable performance hit. 

This also eliminates the extra time spent opening or closing numerous connections, equating to faster and more reliable application delivery. Why not make better use of those idle connections?

It's important to remember that maintaining open connections still incurs a resource cost—mostly in terms of memory needed to keep track of the connection (and store any required TLS keys). By looking at your unique application needs and assessing the impacts of connections at operational scale, you can evaluate if connection pooling is potentially beneficial. Outcomes will depend on factors such as hardware specifications, latency, technology stack (which database you're using, for example), and typical application behaviors in production.

Does HAProxy support connection pooling?

Yes! Connection pooling is an important application acceleration feature in HAProxy Enterprise, which saves both time and precious compute resources for your most demanding applications. To learn more about connection pooling, check out our HTTP Keep-Alive, Pipelining, Multiplexing & Connection Pooling blog post. You can also dive into the nitty gritty within our Configuration Manual.