当前位置:网站首页>io.lettuce.core。RedisCommandTimeoutException命令超时

io.lettuce.core。RedisCommandTimeoutException命令超时

2022-08-09 06:28:00 Koala Rice Bowl

Environment Configuration

redis 3 master 3 slaves, the client is lettuce development environment cpu 12 cores, test environment cpu 2 cores

spring:redis:timeout: 5000 # in milliseconds#database: 0ssl: falsecluster:password: *************nodes: 172.18.226.82:7001,172.18.226.82:7002,172.18.226.82:7003,172.18.226.82:7004,172.18.226.82:7005,172.18.226.82:7006max-redirects: 3 # Get the maximum number of failed redirectslettuce:pool:max-active: 500 #The maximum number of connections in the connection pool (use a negative value to indicate no limit)max-idle: 100 # The maximum idle connection in the connection poolmin-idle: 50 # The minimum idle connection in the connection poolmax-wait: -1 # The maximum blocking waiting time of the connection pool (use a negative value to indicate no limit)

The timeout is set to 5 seconds, because of business requirements, there is a time-consuming between 15-20 for the cache refresh time;

Time:

Development environment: about 10s, no RedisCommandTimeoutException exception was generatedTest environment: io.lettuce.core.RedisCommandTimeoutException: Command timed out exception occurs in about 20s

Cause analysis:

  • All netty threads are busy causing delays in decoding and sending commands from Redis response

  • All connections are busy

  • The Redis server took too long to respond to the request.

Solution:

  • timeout time adjustment (can be solved in most cases)
  • Improve server hardware performance
  • Reduce cache refresh method

The data processing efficiency of the test environment is low, and the exception disappears after setting the timeout to 50000ms

原网站

版权声明
本文为[Koala Rice Bowl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208090622259839.html