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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.