Connection Pooling can increase the database performance to a huge extent.
Connection pools are actually containers that contain open and reusable connections. Multiple pools can exist in the same application domain at the same point in time, but Connection Pools cannot be shared across application domains. Note that one pool is created per unique connection string. A Connection Pool is created the first time a request for a connection to the database comes in with a unique connection string. Note that if another request comes in with a different connection string for the database, another Connection Pool would be created. Hence, we have one Connection Pool per connection string and not per database.
A Connection Pool is maintained internally by the Connection Pool Manager. When a request for a subsequent connection comes in, the Connection Pool Manager searches the pool for the availability of a free connection and returns it to the application if one is available. The following points elaborate how the Connection Pool Manager works- the operations that it performs when a request for a new connection comes to it.
· If any unused connection is available, it returns one.
· If all connections are used up, a new connection is created and added to the pool.
· If the number of connections reaches the maximum number of connections in the pool, the requests are queued until a connection becomes free for reuse.
Connection Pooling is controlled and the parameters passed to a connection string that basically comprises the following:
· Connect Timeout
· Min Pool Size
· Max Pool Size
· Pooling
Connection pooling in web.config files.
name="sqlConnectionString"
connectionString="Data Source=vhimabindu;Initial Catalog=DNN;password=himavejella;Integrated Security=True; Pooling=true; Max pool size=200; Min poolsize=0" />
The same can be done in the code behind file while writing the connection string.
SenthilkumarRank #387 · 6.5K reputationPosted Apr 11, 2012, 6:21 PM EDT
For more info:
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 11, 2012, 6:58 PM EDT
Please refer Our recommended articles
http://www.c-sharpcorner.com/UploadFile/dsdaf/ConnPooling07262006093645AM/ConnPooling.aspx
http://www.c-sharpcorner.com/uploadfile/mahesh/understanding-connection-pooling-in-ado-net/default.aspx
http://www.c-sharpcorner.com/uploadfile/4d56e1/connection-pooling-ado-net/default.aspx
http://www.c-sharpcorner.com/UploadFile/munnamax/connectionpooling08112007062332AM/connectionpooling.aspx
Thanks
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts