J
Jose_Manuel_Jurado
Recently, I worked on a service request that a customer application reported the following error connecting to the database: "Timeout attempting to open the connection. The time period elapsed prior to attempting to open the connection has been exceeded. This may have occurred because of too many simultaneous non-pooled connection attempts.".
Following, I would like to share the experience learned here.
Working on our customer we identified that this application is under a high workload and multiple threads making numerous simultaneous database requests at the same time.
In this situation, we observed that the application was not using connection pooling, meaning each new request was opening a new connection to the database. The application's multi-threaded design, combined with the volume of requests, quickly exceeded the customer machine's capacity to handle these non-pooled connections, causing connection attempts to time out.
After a recomendation to use the connection pooling we were able to resolve this issue because connection pooling active database connections rather than establishing new ones with each request. This can dramatically improve performance and reduce latency. Without pooling, every thread must individually establish a connection, which increases overhead and risks timeout errors when requests are frequent.
For this special situation, after enabling connection pooling we suggested to review several application's database connection settings.
Continue reading...
Following, I would like to share the experience learned here.
Working on our customer we identified that this application is under a high workload and multiple threads making numerous simultaneous database requests at the same time.
In this situation, we observed that the application was not using connection pooling, meaning each new request was opening a new connection to the database. The application's multi-threaded design, combined with the volume of requests, quickly exceeded the customer machine's capacity to handle these non-pooled connections, causing connection attempts to time out.
After a recomendation to use the connection pooling we were able to resolve this issue because connection pooling active database connections rather than establishing new ones with each request. This can dramatically improve performance and reduce latency. Without pooling, every thread must individually establish a connection, which increases overhead and risks timeout errors when requests are frequent.
For this special situation, after enabling connection pooling we suggested to review several application's database connection settings.
- Adjust Max Pool Size
Define an appropriate Max Pool Size to suit the application's load. This parameter sets the maximum number of connections in the pool, helping control the number of active connections and prevent excessive resource consumption.
Monitor and Adjust Timeout Settings
Evaluate and adjust Connection Timeout values as needed. Setting timeouts too low can trigger unnecessary failures under minor delays, while a very high timeout could mask connection problems that should be addressed directly.
Audit the Connection Lifecycle
Ensure that connections are properly closed or returned to the pool once they are no longer needed. Open connections that are not closed can quickly exhaust the pool, leading to similar timeout issues.
Continue reading...