Running multiple PgBouncer on the same port to leverage multiple cores
PgBouncer is a single process; therefore, it can only leverage one core on the system. Sometimes, leveraging a single thread becomes a bottleneck for performance. Therefore, PgBouncer also has specific parameters that allow users to run multiple instances of PgBouncer on the same port and host.
Getting ready
Suppose a user wants to run two instances of PgBouncer on the same port and hosts – you need three Unix directories and three different pgbouncer.ini files for the instances.
Before you try this recipe, you should have gone through the previous recipe on Setting up a connection pool.
How to do it…
Follow the steps given below:
- Use the
pgbouncer.inimentioned in the recipe Setting up a connection pool, and create a separate configuration file for each PgBouncer instance, likepgbouncer1.iniandpgbouncer2.ini. For the first PgBouncer instance, add the following lines...