Database – How Database Connection Pooling Improves Performance

databaseweb-applications

I can't understand why connection pooling improves application performance.

I suppose connection establishment would cause latency. But reusing an established connection requires more complex error handling. Application server need track state of every connection to set connection to initial state before reusing (such as discarding all transactions, switching to the default isolation level), which also costs time.

Best Answer

The complex error handling is usually provided by libraries, and if your application is well-behaved, it shouldn't be needed too much anyway. The complex error handling required during attempting to create a new connection is far more likely to be invoked.

Reseting the state of the connection is trivial and inexpensive; it's built into all modern connection managers that I'm aware of.

Nothing can reduce the overheads of creating a new connection to a database.

Related Topic