PostgreSQL Connection Pooling: Part 2 – PgBouncer

When it entails connection pooling inside the PostgreSQL world, PgBouncer is likely to be the popular selection. It’s a fairly easy utility that does exactly one issue – it sits between the database and the consumers and speaks the PostgreSQL protocol, emulating a PostgreSQL server. A shopper connects to PgBouncer with the exact same syntax it’d use when connecting on to PostgreSQL – PgBouncer is definitely invisible.

PgBouncer is supported by practically every PostgreSQL DBaaS vendor, and extensively used all through the group. In this weblog publish, we’ll make clear how PgBouncer works, the professionals and cons of using it, and the way one can setup the connection pooler. If you’d want to know additional about connection pooling typically, or questioning if it’s correct in your deployment, check out our PostgreSQL (*2*) Pooling: Part 1 – Pros & Cons publish.

How Does PgBouncer Work?

When PgBouncer receives a shopper connection, it first performs authentication on behalf of the PostgreSQL server. PgBouncer helps the entire authentication mechanisms that PostgreSQL server helps, along with a host-based-access configuration (remember: we can’t route replication connections by the use of PgBouncer). If a password is provided, the authentication may very well be carried out in two strategies:

PgBouncer first checks the userslist.txt file – this file specifies a set of (username, md5 encrypted passwords) …

Read More on (*2*)