Connection pooling using PgBouncer
Here in this recipe we are going to implement PgBouncer and benchmark the results for database connections made to the database via PgBouncer against normal database connections.
Getting ready
Before we configure and implement connection pooling, the PgBouncer utility must be installed prior to performing the steps mentioned in this recipe. Installing PgBouncer is covered in the previous recipe.
How to do it...
First we are going to tweak some of the configuration settings in the
pgbouncer.ini
configuration file, as shown in the following snippet. The first two entries are for the databases that will be passed through PgBouncer. Next we configure thelisten_addr
parameter to*
, which means that it is going to listen on all IP addresses. Finally, we set the last two parameters, which areauth_file
, that is, the location of the authentication file, andauth_type
, which indicates the type of authentication used. We use plain as the authentication type, which indicates...