【发布时间】:2019-01-10 02:49:27
【问题描述】:
生产环境在 Azure 上,使用 Redis Cache Standard 2.5GB。
示例 1
System.Web.HttpUnhandledException (0x80004005): 类型异常 'System.Web.HttpUnhandledException' 被抛出。 ---> StackExchange.Redis.RedisTimeoutException:执行 SETNX 超时 User.313123,inst:49,mgr:不活动,err:从不,队列:0,qu:0,qs: 0, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: PRD-VM-WEB-2, serverEndpoint:未指定/Construct3.redis.cache.windows.net:6380, keyHashSlot:15649,IOCP:(忙=0,空闲=1000,最小=1,最大=1000),工人: (忙碌=1,空闲=32766,Min=1,Max=32767) (请看这个 有关可能导致超时的一些常见客户端问题的文章: http://stackexchange.github.io/StackExchange.Redis/Timeouts) 在 StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](消息 消息,ResultProcessor
1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 2120 at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 处理器,ServerEndPoint 服务器)在 c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81
示例 2
StackExchange.Redis.RedisTimeoutException:执行 GET 超时 ForumTopic.33831, 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-2, serverEndpoint:未指定/Construct3.redis.cache.windows.net:6380, keyHashSlot:5851,IOCP:(忙=0,空闲=1000,最小=1,最大=1000),工人: (忙碌=1,空闲=32766,Min=1,Max=32767) (请看这个 有关可能导致超时的一些常见客户端问题的文章: http://stackexchange.github.io/StackExchange.Redis/Timeouts) 在 StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](消息 消息,ResultProcessor
1 processor, ServerEndPoint server) in c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\ConnectionMultiplexer.cs:line 2120 at StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 处理器,ServerEndPoint 服务器)在 c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisBase.cs:line 81 在 StackExchange.Redis.RedisDatabase.StringGet(RedisKey 键, CommandFlags 标志)在 c:\code\StackExchange.Redis\StackExchange.Redis\StackExchange\Redis\RedisDatabase.cs:line 1647 在 C3.Code.Controls.Application.Caching.Distributed.DistributedCacheController.Get[T](String 缓存键)在 C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Distributed\DistributedCacheController.cs:line 115 在 C3.Code.Controls.Application.Caching.Manager.Manager.Get[T](字符串 key, Func`1 getFromExternFunction, Boolean skipLocalCaches) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Manager.cs:line 159 在 C3.PageControls.Forums.TopicRender.Page_Load(对象发件人, EventArgs e) 在 C:\Construct.net\Source\C3Alpha2\PageControls\Forums\TopicRender.ascx.cs:line 40 在 System.Web.UI.Control.OnLoad(EventArgs e) 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Page.ProcessRequestMain(布尔值 includeStagesBeforeAsyncPoint,布尔型 includeStagesAfterAsyncPoint)
这些错误是零星的,一天几次。
这是 Azure 网络问题,还是我可以减少的问题?查看错误中的数字似乎没有什么异常,服务器负载似乎从未超过 Azure 报告的 7%。
Redis 连接
internal static class RedisController
{
private static readonly object GetConnectionLock = new object();
public static ConnectionMultiplexer GetConnection()
{
if (Global.RedisConnection == null)
{
lock (GetConnectionLock)
{
if (Global.RedisConnection == null)
{
Global.RedisConnection = ConnectionMultiplexer.Connect(
Settings.Deployment.RedisConnectionString);
}
}
}
return Global.RedisConnection;
}
【问题讨论】:
-
有几个步骤可以调查 Azure Redis 超时问题,它可能会有所帮助:azure.microsoft.com/en-us/blog/…
-
你每秒发出多少个请求?我想知道是否有速率限制来防止可疑的 DoS 攻击。您是否尝试过在另一个服务上运行它? aws, rackspace, local,看看你是否还有超时?
-
@varlogtim 无法在另一个基础架构上测试它,因为它正在投入生产 - 开发服务器从未见过这个错误(我也在开发中使用 Redis)。
-
@TomGullen - 你能把代码 sn-p 贴在你打开 redis 客户端的地方吗?
-
我开始认为这只是 StackExchange.Redis 客户端的一个错误。我有the same problem 并没有得到任何地方。它在我们的生产服务器上造成了很多问题。
标签: azure redis timeout stackexchange.redis