读取redis数据报超时错误:
Redis server response timeout (3000 ms) occured after 3 retry attempts
2024-07-18 17:07:57.124 ERROR [e8f07b0a671c08311dff589827897232] [http-nio-9528-exec-6] c.z.i.u.m.c.e.BaspUserExceptionHandler.exceptionHandler:83 - RuntimeException:java.util.concurrent.ExecutionException: org.springframework.dao.QueryTimeoutException:Redis server response timeout (3000 ms) occured after 3 retry attempts, is non-idempotent command: false Check connection with Redis node: for TCP packet drops. Try to increase nettyThreads and/or timeout settings. Command: (LRANGE), params: [[118, 111, 108, 116, 101, 58, 111, 114, 103, 58, ...], 0, -1], channel: [];nested exception is org.redisson.client.RedisResponseTimeoutException: Redis server response timeout (3000 ms) occured after 3 retry attempts, is non-idempotent command: false Check connection with Redis node: for TCP packet drops. Try to increase nettyThreads and/or timeout settings. Command:
问题排查
- 根据报错后的提示,将客户端超时时间改大一些。
- 通过异常分析,发现出现异常的地方为set操作,一分析,是value值过大,导致超时。
- 确认问题发生时的操作,若为执行操作时Key值过大,也会造成超时报错。一般建议key不要超过10KB。
单key大小,Redis限制每个String类型value大小不超过512MB,
实际开发中,不要超过10KB,否则会对CPU和网卡造成极大负载。
hash、list、set、zset元素个数不要超过5000。
理论上限: 每个hashset里元素数量< 2^32。
根据报错后的提示,将客户端参数PingConnectionInterval调大试试。
查看redisson配置,调大参数PingConnectionInterval