asp.net - 为什么 asp.net 上的 Azure Redis 缓存仅使用 1000 个连接的客户端并抛出超时错误?

标签 asp.net azure azure-redis-cache

在过去的几天里,我正在尝试优化我的网站,因为当我有连接高峰时,redis 缓存导致性能低下。

我使用的是redis版本1.2.6,并且我在连接字符串中设置了abortConnect=false

这是我如何获得与 Redis 的连接:

private static readonly Lazy<ConnectionMultiplexer> LazyConnection
  = new Lazy<ConnectionMultiplexer>(() => 
ConnectionMultiplexer.Connect(GetRedisConnectionString()));

private static readonly Lazy<ConnectionMultiplexer> LazyConnection
  = new Lazy<ConnectionMultiplexer>(() =>
  {
      var connection = ConnectionMultiplexer.Connect(GetRedisConnectionString());
      connection.PreserveAsyncOrder = false;
      //connection.TimeoutMilliseconds
      return connection;
  });

在 global.asax 中,我按照本文的建议更改了最小线程 http://stackexchange.github.io/StackExchange.Redis/Timeouts

    int workerThreads = 500;
    int iocpThreads = 500;

    System.Threading.ThreadPool.SetMinThreads(workerThreads, iocpThreads)

但是我们在日志中仍然有一些像这样的错误:

Timeout performing GET campaign_url_728566_288, inst: 19, mgr: Inactive, 
err: never, queue: 7, qu: 0, qs: 7, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, 
clientName: RD00155D881345, serverEndpoint: 
Unspecified/**********************, keyHashSlot: 6859, IOCP: 
(Busy=0,Free=1000,Min=500,Max=1000), WORKER: 
(Busy=25,Free=8166,Min=500,Max=8191)

Timeout performing GET campaign_url_728566_288, inst: 7, mgr: Inactive, err: 
never, queue: 24, qu: 0, qs: 24, qc: 0, wr: 0, wq: 0, in: 4488, ar: 0, 
clientName: RD00155D881345, serverEndpoint: Unspecified**********, 
keyHashSlot: 6859, IOCP: (Busy=0,Free=1000,Min=500,Max=1000), WORKER: 
(Busy=40,Free=8151,Min=500,Max=8191)

现在我注意到创建并在门户中显示的最大连接数为最大 20,而我预计在高流量期间会拥有更多连接。 azure redis connection

是否有任何设置可以增加 ConnectionMultiplexer 的连接数?或者问题与缓存的大小(当前为 C1 标准)或由于带宽有限有关?

最佳答案

此类问题可能是由服务器或客户端问题引起的。您查看过https://gist.github.com/JonCole/db0e90bedeb3fc4823c2#file-diagnoserediserrors-clientside-md吗?和 https://gist.github.com/JonCole/9225f783a40564c9879d#file-diagnoserediserrors-serverside-md

如果您通过 https://gist.github.com/JonCole/132b255425268459ec95#file-supportquestionnaire-md 向我们发送以下信息 ( [email protected] ) ,我们也可以调查一下服务器上是否存在任何瓶颈以及我们可能有什么建议。

关于asp.net - 为什么 asp.net 上的 Azure Redis 缓存仅使用 1000 个连接的客户端并抛出超时错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48149329/

相关文章:

母版页和内容占位符中的 Javascript 验证

Jquery post 和不显眼的 ajax 验证不起作用 mvc 4

azure - `where * contains ` 和 `search` 在 KQL 中是同一个运算符吗?

c# - 从 Azure Web 应用程序提供 Logstash。如何?

azure - Azure 上的桌面应用程序

redis - 处理 Azure Redis 缓存异常

Azure Redis 缓存突然空了?

asp.net - 在 EditItemTemplate 内的 ControlParameter 中找不到 Control

c# - Microsoft Office Interop Excel 12.0 无法在 IIS 7 中工作

Azure Redis 集群关键事件失效事件