Middleware
Connection pooling
Many client connections share a smaller set of server connections, because a database connection is expensive and mostly idle.
The trade is that server connections stop belonging to one client, so anything scoped to a session rather than a transaction stops being reliable. The pool mode is the whole decision.
Explained in depth
PgBouncer
PostgreSQL connection pooling with PgBouncer - pool modes and what each one breaks, sizing the pool, secure auth_query, and running it multi-core.
Pgpool-IIPgpool-II in practice - clustering modes, how load balancing decides where a SELECT goes, watchdog quorum, failover, and the diagnostics.