我正在使用Azure Redis(使用Stackexchange.Redis)作为缓存存储,它通常运行良好。但是我偶尔会遇到超时错误,而我无法确定为什么会发生这种情况。
我的redis连接设置:
value="dev.redis.cache.windows.net,ssl=true,password=secret,abortConnect=false,syncTimeout=3000"
我在同一秒钟内收到了所有这些异常(多次调用):[我在GET操作中也会遇到这些异常。几乎所有这些异常都是在StringSet和StringGet上发生的。我很少在HashSets或HashGets上遇到异常]
Timeout performing SET {key}, inst: 1, mgr: ExecuteSelect, queue: 6, qu=0, qs=6, qc=0, wr=0/0, in=0/0
SocketFailure on SET
SocketFailure on SET
No connection is available to service this operation: SET
我猜测设置对象所需的时间比预期更长,这可能是由于对象过大,因此我可以增加synctimeout,但这是否会隐藏其他问题呢?
我只在对stackexchange.redis进行同步调用时才收到这些异常,当调用异步时我没有看到异常。
堆栈跟踪:
StackExchange.Redis.RedisConnectionException: SocketFailure on SET
at StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor`1 processor, ServerEndPoint server) i
at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor`1 processor, ServerEndPoint server)
at StackExchange.Redis.RedisDatabase.StringSet(RedisKey key, RedisValue value, Nullable`1 expiry, When when, CommandFlags flags)
at calling method
编辑:我正在使用StackExchange.Redis 1.0.414包,并使用MessagePack将我的对象序列化。