Connection Pooling
Connection Pooling : Is a technical concept, with which the connection to the database is done using the already created connection objects. When we say, already created connections means, the connections which are created and kept is a store called connection pool, from where the connection objects are easily accessed.Why connection pooling ?
The use of connection pools allows us to access database faster, the cached connection objects are taken from the pool and the program can query the database faster.
1. Connection is a heavy resource, which utilizes more time. Thus reducing the overhead of creating connections connections and destroying connections all the time.
You may try running any sample SQL query and see.
1) SET profiling = 1;
2) Your Sql query
3) SHOW PROFILE FOR QUERY 1;
Advantages
- Performance: Creating connection to the database is slow, with connection pooling, it becomes much faster.
- Diagnostics & Maintainability If you have one sub-system responsible for connecting to the database, it becomes easier to diagnose and analyze database connection usage. And your code will be easier to maintain, in other way around each functionality connects to the database by itself.
No comments