Book Image

PostgreSQL Replication, Second Edition

Book Image

PostgreSQL Replication, Second Edition

Overview of this book

Table of Contents (22 chapters)
PostgreSQL Replication Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 8. Working with PgBouncer

When you are working with a large-scale installation, it is sometimes quite likely that you have to deal with many concurrent open connections. Nobody will put up 10 servers to serve just two concurrent users; in many cases, this simply makes no sense. A large installation will usually have to deal with hundreds, or even thousands, of concurrent connections. Introducing a connection pooler, such as PgBouncer, will help improve performance of your systems. PgBouncer is really the classic workhorse when it comes to connection pooling. It is rock solid and it has already been around for many years.

Usually creating thousands and thousands of connections can be quite an overhead, because every time a connection to PostgreSQL is created, a fork() call is required. If a connection is only used for a short period of time, this can be expensive to do. This is exactly when PgBouncer should be used. Basically, PgBouncer is not a replication-related tool. However, we...