How it works…
Why even have this recipe? We're glad you asked!
We introduced PgBouncer in Chapter 4, Proxy and Pooling Resources, and it gives us the ability to transparently redirect application connections from one server to another without interrupting transaction activity. This is the secret sauce that no other proxy approach can match.
A virtual IP address would interrupt active transactions unless we stopped the application. HAProxy would as well. The only proxy software that understands the PostgreSQL communication protocol is PgBouncer, and we want to take advantage of that.
The other essential capability PgBouncer provides is to PAUSE and RESUME session activity. Unlike RECONNECT, which only marks existing connections as needing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access