CacheManager.NET SCRIPT执行似乎不尊重StackExchange Redis的SyncTimeout

时间:2017-10-22 16:08:15

标签: stackexchange.redis cachemanager

在应用程序服务器上负载很重的情况下,使用CacheManager.NET和Redis作为后端时偶尔会出现以下错误,

Redis Connection Timeout Exception :Timeout performing SCRIPT, inst: 0, mgr: CheckForStaleConnections, err: never, queue: 11596, qu: 11596, qs: 0, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: HOST, serverEndpoint: Unspecified/SREDIS01:6379, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=0,Free=2047,Min=4,Max=2047), Local-CPU: 4.84% (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), While GetOrAdd key :XYZ|

虽然我们已在ConnectionMultiplexer中将SyncTimeout设置为10000(10秒)并将ConnectTimeout设置为5秒,但系统会卡住约50到60分钟(有时甚至更多)。请注意,只有在执行SCRIPT命令时才会出现此问题,Cache Manager在初始化时执行。

Stack Trace是:

   at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server)
   at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server)
   at StackExchange.Redis.RedisServer.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server)
   at StackExchange.Redis.RedisServer.ScriptLoad(String script, CommandFlags flags)
   at StackExchange.Redis.LuaScript.Load(IServer server, CommandFlags flags)
   at CacheManager.Redis.RedisCacheHandle`1.LoadScripts()
   at CacheManager.Redis.RedisCacheHandle`1.Eval(ScriptType scriptType, RedisKey redisKey, RedisValue[] values, CommandFlags flags)
   at CacheManager.Redis.RedisCacheHandle`1.<>c__DisplayClass48_0.<GetCacheItemAndVersion>b__0()
   at CacheManager.Redis.RetryHelper.Retry[T](Func`1 retryme, Int32 timeOut, Int32 retries, ILogger logger)
   at CacheManager.Redis.RedisCacheHandle`1.Retry[T](Func`1 retryme)
   at CacheManager.Redis.RedisCacheHandle`1.GetCacheItemAndVersion(String key, String region, Int32& version)
   at CacheManager.Redis.RedisCacheHandle`1.GetCacheItemInternal(String key, String region)
   at CacheManager.Core.Internal.BaseCache`1.GetCacheItem(String key, String region)
   at CacheManager.Core.BaseCacheManager`1.GetCacheItemInternal(String key, String region)
   at CacheManager.Core.Internal.BaseCache`1.GetCacheItem(String key, String region)
   at CacheManager.Core.Internal.BaseCache`1.Get(String key, String region)

我浏览了StackExchange Redis的Timeout文档,并且可以理解由于客户端计算机上CPU使用率非常高,一些连接可能会遇到此类问题。

然而,我们最关心的是它应该在10秒内超时并且不应该停留数分钟/小时。

请你在这里指导我们。

0 个答案:

没有答案