stackexchange.redis throws timeout even after increasing timeout?

早过忘川 提交于 2021-01-28 06:45:25

问题


I am getting the following error when trying to delete from my cache:

Timeout performing DEL test.com, inst: 0, mgr: ExecuteSelect, err: never, queue: 0, qu: 0, qs: 0, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: ORLWS052, serverEndpoint: Unspecified/pub-redis-16778.us-west-2-1.1.ec2.garantiadata.com:16778, keyHashSlot: 6928, IOCP: (Busy=3,Free=997,Min=4,Max=1000), WORKER: (Busy=4,Free=4091,Min=4,Max=4095), Local-CPU: 100% (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)

I also get an similar timeout when updating.

I have no idea how to read this, so if anyone knows that would be helpful.

The size of the key I am trying to update or delete is 5515 bytes.

I also ran the slowlog get command and there is none (the length is 0)

I also tried to increase the timeout, but that didn't work either


回答1:


IOCP: (Busy=3,Free=997,Min=4,Max=1000), WORKER: (Busy=4,Free=4091,Min=4,Max=4095), Local-CPU: 100%

Please check your ICOP, WORKER busy threads and minimum threads. Also the CPU is 100%. The timeoutHelpLink was updated in the latest release.

https://stackexchange.github.io/StackExchange.Redis/Timeouts

If we look at an example error message from StackExchange.Redis (build 1.0.450 or later), you will see that it now prints ThreadPool statistics (see IOCP and WORKER details below).

System.TimeoutException: Timeout performing GET MyKey, inst: 2, mgr: Inactive, queue: 6, qu: 0, qs: 6, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, IOCP: (Busy=6,Free=994,Min=4,Max=1000), WORKER: (Busy=3,Free=997,Min=4,Max=1000)

In the above example, you can see that for IOCP thread there are 6 busy threads and the system is configured to allow 4 minimum threads. In this case, the client would have likely seen two 500 ms delays because 6 > 4.

Note that StackExchange.Redis can hit timeouts if growth of either IOCP or WORKER threads gets throttled.

Recommendation: Given the above information, it's recommend to set the minimum configuration value for IOCP and WORKER threads to something larger than the default value. We can't give one-size-fits-all guidance on what this value should be because the right value for one application will be too high/low for another application. This setting can also impact the performance of other parts of complicated applications, so you need to fine-tune this setting to your specific needs. A good starting place is 200 or 300, then test and tweak as needed.




回答2:


I faced the same issue and managed to solve it by changing of syncTimeout parameter. By default it's 1000 ms. https://stackexchange.github.io/StackExchange.Redis/Configuration.html

According to the sources it also impacts on AsyncTimeout. https://github.com/StackExchange/StackExchange.Redis/blob/3f7e5466c6bbff96a3ed1130b637a097d21f3fed/src/StackExchange.Redis/ConfigurationOptions.cs#L171



来源:https://stackoverflow.com/questions/44114824/stackexchange-redis-throws-timeout-even-after-increasing-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!