redis - StackExchange.Redis 的 SETNX 超时

标签 redis timeout stackexchange.redis

在野外捕捉到这个随机异常:

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.TimeoutException: Timeout performing SETNX GeoIP.[REDACTED], inst: 1, mgr: Inactive, err: never, queue: 2, qu: 0, qs: 2, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: PRD-VM-WEB-1, serverEndpoint: Unspecified/[REDACTED].redis.cache.windows.net:6380, keyHashSlot: 3519, IOCP: (Busy=0,Free=1000,Min=2,Max=1000), WORKER: (Busy=1,Free=32766,Min=2,Max=32767), Local-CPU: unavailable (Please take a look at this article for some common client-side issues that can cause timeouts: https://github.com/StackExchange/StackExchange.Redis/tree/master/Docs/Timeouts.md) at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server)

使用部署在 Azure 上的 StackExchange.Redis。

referenced cached document 中我可以看出看起来不错,也许 Local-CPU 不可用值是问题所在?

有谁知道是什么导致了这个抛出?

最佳答案

当您查看收到的错误时,您是否看到 BUSY 值大于 IOCP 或工作线程池的 MIN 的任何超时错误?如果是这样,线程池节流可能是原因。这通常发生在突发情况下。这通常伴随着高 CPU,这也会导致超时。此处解释了线程池节流:https://gist.github.com/JonCole/e65411214030f0d823cb#file-threadpool-md .

另外,这里有一些最佳实践:https://gist.github.com/JonCole/925630df72be1351b21440625ff2671f#best-practices-for-azure-redis

关于redis - StackExchange.Redis 的 SETNX 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43289139/

相关文章:

javascript - Angular.js - 正在使用 $timeout 肮脏的解决方法吗?

asp.net - Redis 是适合公司警报消息系统的消息系统吗?

redis - 对 Redis 从属设备的循环读取请求

Redis——AOF持久化

java - 如何在spring-boot-starter-data-redis中获取Jedis实例?

node.js - 使用 redis 报错

c - Select() 不起作用

php - PHP中的函数超时

c# - 从 Redis 检索多个键时死锁

Redis - StackExchange.Redis - 使用 C# 驱动程序进行批量插入时缺少键