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...

  1. 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 the listen_addr parameter to *, which means that it is going to listen ...

Get PostgreSQL High Performance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.