How does connection pooling work?

How does connection pooling work?

If Dedicated Servers are private chauffeurs and Shared Servers are public buses, then Connection Pooling is like a high-end Car-Sharing Service (like Zipcar or Uber).

In a modern web environment, thousands of users might visit your site every minute. If the database had to create a brand-new connection for every single person who clicked a link, the server would crumble under the weight of the "handshake" overhead.

Connection pooling solves this by keeping a cache of "ready-to-use" connections alive.


1. The Problem: The High Cost of "Hello"

Connecting to an Oracle database is an expensive operation in terms of time and CPU. When an application requests a new connection, Oracle must:

  1. Authenticate the user (check password/permissions).

  2. Allocate memory (PGA) on the server.

  3. Spawn a new process or thread.

  4. Establish the network handshake.

This can take hundreds of milliseconds. If your web page needs to load in under 2 seconds, you can't afford to waste 20% of that time just saying "hello" to the database.


2. How the Pool Works

A Connection Pool sits between the Application Server (like Java, Python, or .NET) and the Database.

  1. Startup: When the app server starts, it creates a "pool" of, say, 20 open connections to Oracle.

  2. Request: A user visits the site. The app borrows an existing, authenticated connection from the pool.

  3. Execution: The app runs the SQL and gets the results.

  4. Release: Instead of "closing" the connection, the app returns it to the pool. The connection stays logged in to Oracle, waiting for the next user.


3. Client-Side vs. Server-Side Pooling

Not all pools live in the same place. There are two main ways to implement this:

A. Client-Side Pooling (Most Common)

Frameworks like HikariCP (Java), SQLAlchemy (Python), or ODP.NET manage the pool within the application's memory.

  • Pro: Lightning fast; the application doesn't even have to talk to the network to "get" a connection.

  • Con: If you have 10 separate app servers each holding 50 connections, you have 500 open sessions on your database, even if no one is using the site.

B. Database Resident Connection Pooling (DRCP)

This is an Oracle-specific feature (introduced in 11g) where the pool lives on the database server itself.

  • Pro: It allows thousands of different application processes to share a small, manageable pool of server-side "connection brokers."

  • Best For: Languages like PHP or Python that traditionally struggle with persistent connections.


4. Connection Pooling vs. Shared Server

People often confuse these two, but they happen at different layers:

FeatureConnection PoolingShared Server (MTS)
LocationApplication Side / Driver.Database Side / Instance.
Main GoalAvoid the cost of re-connecting.Reduce the number of OS processes.
ConnectivityConnections are held open.Sessions are "multiplexed" over workers.

5. The "Golden Rules" of Pooling

To avoid database "hangs," keep these settings in mind:

  • Min Pool Size: How many connections stay open during quiet hours (e.g., 5).

  • Max Pool Size: The absolute limit. If your app hits this, users will wait in a queue. Never set this higher than your database's SESSIONS parameter can handle.

  • Max Idle Time: How long a connection can sit unused before the pool kills it to save memory.


Peer Tip: The most common cause of "Database Hanging" in web apps isn't the database—it's a Connection Leak. This happens when a developer "borrows" a connection from the pool but forgets to "return" it in their code. Eventually, the pool empties, and the app stops working.

Looking for servers Rental ?

Call Our Expert :


  • (call for rental enquiries)

Email us :