首页 > 解决方案 > NET API 中的 Azure Redis 超时

问题描述

我有带有 StackExchange.Redis v2.0.61 的 asp net v4.6.1 并且由于 redis 的实施,我总是随机出现相同的错误,如果有人可以提供帮助,这里是一些错误日志,我关注了官方文档/微软论坛提供有助于减少错误数量和更改线程池的步骤。

Timeout performing GET (2000ms), next: GET key, inst: 0, qu: 0, qs: 9, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: Unspecified/{myserver}:6380, mgr: 10 of 10 available, clientName: {myclient}, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=38,Free=8153,Min=4,Max=8191), v: 2.0.601.3402 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts) 

.

Timeout performing GET (2000ms), next: GET key1, inst: 1, qu: 0, qs: 6, aw: False, rs: ReadAsync, ws: Idle, in: 34344, serverEndpoint: Unspecified/{myserver}:6380, mgr: 10 of 10 available, clientName: {myclient}, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=39,Free=8152,Min=4,Max=8191), v: 2.0.601.3402 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts) 

.

Timeout performing GET (2000ms), next: GET key2, inst: 12, qu: 0, qs: 10, aw: False, rs: ReadAsync, ws: Idle, in: 10159, serverEndpoint: Unspecified/{myserver}:6380, mgr: 10 of 10 available, clientName: {myclient}, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=25,Free=8166,Min=4,Max=8191), v: 2.0.601.3402 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts) 

蔚蓝统计:

内存 105MO~ / CPU : 0%~25%

在此处输入图像描述

谢谢 ;

标签: asp.netazureredisstackexchange.redis

解决方案


看起来您正在客户端计算机上遇到请求/响应的备份,这会导致以后的请求超时。这可能是由于线程不足或由于昂贵的响应处理逻辑。

在所有三个例外中,这些WORKER部分显示的Busy线程数大于Min.NET 在 .NET 中保留的计数ThreadPool。您应该调整ThreadPool设置以增加最小计数或了解如何减少客户端中的工作线程数,使其少于Min

在两个异常中,in: number显示number大于 0。这表明响应流中有字节,等待您的客户端应用程序读取。这可能是由于客户端应用程序发送请求的速度快于处理其响应的速度。缓慢的响应处理通常表明正在使用响应值执行昂贵的逻辑,尽管由于线程不足,这可能会进一步减慢。

https://stackexchange.github.io/StackExchange.Redis/Timeouts
https://docs.microsoft.com/azure/azure-cache-for-redis/cache-troubleshoot-client#traffic-burst


推荐阅读