StackExchange / StackExchange/StackExchange.Redis

Timeout Exceptions in .NET 6 (Azure Redis Cache + Kubernetes)

Open
#2,690 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Hello!

We have a .NET Core MVC Application that is deployed to multiple K8s pods, all using the same Azure Redis Cache instance. We are currently experiencing a large number of timeout exceptions, and have been trying to diagnose them for weeks with no luck. A few exception examples:

Timeout performing GET (5000ms), next: GET {KEY}, inst: 0, qu: 0, qs: 1, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: {ENDPOINT NAME}, mc: 1/1/0, mgr: 10 of 10 available, clientName: {CLIENTNAME}, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=10,Max=32767), v: 2.2.4.27433 (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 SETEX (5000ms), next: SETEX {KEY}, inst: 0, qu: 0, qs: 1, aw: False, rs: ReadAsync, ws: Idle, in: 0, serverEndpoint: {ENDPOINT NAME}, mc: 1/1/0, mgr: 10 of 10 available, clientName: {CLIENTNAME}, IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER: (Busy=1,Free=32766,Min=10,Max=32767), v: 2.2.4.27433 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)

We are using a ConnectionMultiplexer that is registered as a singleton, and is then used in our CacheService class:
public string GetCacheString(string key) { var cache = _connectionMultiplexer.GetDatabase(); return cache.StringGet(key); }

So far we have tried the following with no luck:

  • Using the IDistributedCache interface
  • Increasing thread count

Our SLOWLOG does report slow commands, but none of them are taking longer than the timeout value we have set (default 5000ms). A note on our apps behavior - there can be thousands of users hitting our app at once, and most requests utilize Redis in some way to see if data exists in Redis before querying our SQL DB. These users can be sending the same exact requests at the same time.

Any help with this is appreciated!!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported ConnectionMultiplexer singleton and CacheService.GetCacheString entry point, then review the timeout diagnostics alongside the Azure Redis Cache and Kubernetes deployment details. Done would require identifying the cause of the GET and SETEX timeouts and documenting or implementing a confirmed fix, but the issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, kubernetes, redis
Domain
backend, cloud, databases, infrastructure
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.