Connection Pooling and Load Balancing

When a client attempts a connection to a PostgreSQL database, the postmaster acknowledges the connections and forks a backend process. Thus, each client connection in Postgres is a process in the operating system. The postmaster performs a fork() system call, which creates an address space, file descriptors, and a copy of the memory segments as of the postmaster process. And once the client disconnects, the child process gets terminated.

In a general workload, benchmarks have proven that PostgreSQL performs well up to 350 transactions per second, without a connection pooler. However, when we expect more transactions that could create hundreds or thousands of processes, it is important to maintain a connection ...

Get PostgreSQL 13 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.