tailieunhanh - Taking Advantage of Connection Pooling
[ Team LiB ] Recipe Taking Advantage of Connection Pooling Problem You need to understand connecting pooling and make sure that your applications use it. Solution To effectively use connection pooling, you need to understand the concepts underlying connection pooling | Team LiB Recipe Taking Advantage of Connection Pooling Problem You need to understand connecting pooling and make sure that your applications use it. Solution To effectively use connection pooling you need to understand the concepts underlying connection pooling how connection pooling is implemented by the major .NET data providers and how to ensure that connection pooling is used by an application. Discussion Connection pooling allows an application to reuse connections from a pool instead of repeatedly creating and destroying new connections. Connection pooling can significantly improve the performance and scalability of applications by allowing a smaller number of connections to service the connection requirements of an application and because the overhead of establishing a new connection is eliminated. A connection pool is created for each unique connection string. An algorithm associates items in the pool based on an exact match with the connection string this includes capitalization order of name value pairs and even spaces between name value pairs. Dynamically generated connection strings must be identical so that connection pooling is used. If delegation is used there will be one pool per delegate user. When transactions are used one pool is created per transaction context. For more information see Recipe . When the connection pool is created connection objects are created and added to the pool to satisfy the minimum pool size specified. When a connection is requested by an application and the maximum pool size has been reached the request is queued. The request is satisfied by reallocating a connection that is released back to the pool when the Connection is closed or disposed. The connection pool manager removes expired connections and connections that have had their connection with the server severed from the pool. The Connection object should be closed as soon as it is no longer needed so that it is added to or returned to the connection pool.
đang nạp các trang xem trước