Connection Pooling and Concurrency at Scale
Connection pooling keeps a managed set of open database connections and lends them to concurrent work. It reduces repeated connection setup and limits how many requests can occupy the database at once.
itDatabases and data storage | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
Connection Pooling and Concurrency at Scale
Connection pooling keeps a bounded set of established database connections and lends them to application work. A request checks out a connection, uses it for a query or transaction, and returns it. The physical connection normally remains open for another request.
This arrangement separates application concurrency from database concurrency. An application may serve thousands of requests while allowing only a measured number of queries to execute through database sessions. Requests that arrive while every pooled connection is busy wait in a bounded queue or fail after an acquisition timeout.
Architecture and request flow
A pool contains a connection factory, an idle set, a checked-out set, and a wait queue. The factory opens and authenticates physical connections. Idle connections are ready for reuse. Checked-out connections belong to current work. The wait queue holds callers until capacity returns.
The normal path is:
- A request asks the pool for a connection.
- The pool returns an idle connection or opens one within its maximum size.
- The request performs its database work.
- The request commits or rolls back its transaction.
- Closing the logical handle returns the physical connection to the pool.
- The pool resets required state before the next borrower uses it.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://docs.oracle.com/cd/B10500_01/java.920/a96654/connpoca.htm
Supports
- Physical and logical connection pooling model
- Reuse of established JDBC connections
- Reference-path rationale and beginner quiz
- https://www.postgresql.org/docs/current/runtime-config-connection.html
Supports
- PostgreSQL max_connections and reserved connection slots
- Resource implications of increasing max_connections
- Fleet-budget quiz
- https://wiki.postgresql.org/wiki/Number_Of_Database_Connections
Supports
- Pooling fewer database connections for more concurrent users
- Pool-sizing diagnostic guidance
- https://docs.sqlalchemy.org/en/20/core/pooling.html
Supports
- Queue-based application pooling
- Pool size, overflow, acquisition timeout, recycle, reset, and pre-ping controls
- Logical close and pool-return semantics
- https://github.com/brettwooldridge/HikariCP
Supports
- Acquisition timeout, idle timeout, keepalive, maximum lifetime, validation, and metrics
- Maximum pool behavior and connection retirement
- https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
Supports
- Small saturated pool model
- Database contention from excess concurrent connections
- Load-testing and mixed-workload sizing guidance
- https://www.pgbouncer.org/config
Supports
- Session, transaction, and statement pool modes
- Client, backend, reserve, reset, and timeout controls
- Session-state limits in transaction mode
- PgBouncer Landscape placement
- https://www.pgbouncer.org/usage
Supports
- Operational pool, client, server, and wait statistics
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.howitworks.html
Supports
- Proxy pooling, borrowing, transaction multiplexing, and pinning
- Amazon RDS Proxy Landscape placement
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-connections.html
Supports
- Application-pool lifetime and idle-timeout alignment
- Pinned idle clients holding database connections
- Connection borrow timeout
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-best-practices.workload-considerations.html
Supports
- Pool and proxy sizing alignment
- Session state reducing multiplexing efficiency
- Multi-layer timeout alignment
- https://github.com/sindresorhus/awesome
Supports
- Discovery route to the PostgreSQL awesome list
- https://github.com/sroeschus/awesome-postgresql
Supports
- Discovery of PgBouncer, Odyssey, pgagroal, and the connection-pooling ecosystem
- https://pg-odyssey.tech/features/pooling.html
Supports
- Odyssey client multiplexing and backend resource use
- Awesome Links rationale and Landscape placement
- https://pgagroal.github.io/doc/GETTING_STARTED.html
Supports
- pgagroal setup, connection reuse, and backend pool behavior
- Awesome Links rationale
- https://pgagroal.github.io/doc/CONFIGURATION.html
Supports
- pgagroal maximum, idle, validation, and per-user or per-database controls
- Landscape placement
- https://github.com/postgresml/pgcat
Supports
- PgCat pooling, sharding, load balancing, failover, and mirroring scope
- Awesome Links rationale and Landscape placement
- https://www.pgpool.net/docs/latest/en/html/
Supports
- Pgpool-II connection reuse, load balancing, and high-availability scope
- Landscape placement
- https://supabase.github.io/supavisor/connecting/overview/
Supports
- Supavisor connection model
- Awesome Links rationale and Landscape placement
- https://supabase.com/docs/guides/database/connecting-to-postgres
Supports
- Session and transaction pooler placement for persistent and temporary clients
- https://neon.com/docs/connect/connection-pooling
Supports
- Neon pooled endpoint and transaction-mode PgBouncer behavior
- Landscape placement
- https://docs.prisma.io/docs/accelerate
Supports
- Managed pooling for Prisma ORM and serverless or edge applications
- Landscape placement
- https://www.pgbouncer.org/changelog.html
Supports
- Timeline research decision and 2007 first public release
- https://aws.amazon.com/blogs/aws/amazon-rds-proxy-now-generally-available/
Supports
- Timeline research decision and 2019 preview plus 2020 general availability
