What Should I Do If the Client Connection Pool Reports Error " Could not get a resource from the pool"?
Scenarios
- Jedis client:
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- Lettuce client:
redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection
- Go-redis client:
redis: connection pool timeout You can get that error when there are no free connections in the pool for Options.PoolTimeout duration. If you are using redis.PubSub or redis.Conn, make sure to properly release PuSub/Conn resources by calling Close method when they are not needed any more. You can also get that error when Redis processes commands too slowly and all connections in the pool are blocked for more than PoolTimeout duration.
However, the instance information queried by following Viewing Monitoring Metrics shows that the database QPS, latency, and number of connections are normal and no slow request is displayed.
Possible Causes
Generally, the preceding issue is caused by incorrect configurations of a client connection pool. The maximum number of the connection pools is limited for applications. If the QPS of an application exceeds the limit of the connection pool or connections are not released in time, the thread cannot obtain new connections and services are affected.
Solution
Check whether the QPS and traffic metrics increase sharply last two hours and whether connection pool parameters configured on the Redis clients (such as Jedis and Lettuce) meet service requirements.
For details about how to configure the Redis clients, see Development and O&M Rules and Configuring Parameters for a Client Connection Pool.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot