StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.85k stars 1.5k forks source link

Strange and Cyclical Latency #2637

Closed Joseph-Melberg closed 5 months ago

Joseph-Melberg commented 5 months ago

My application consists of a dotnet6 webapi and two background services.

They each use dependency injection to acquire a singleton Context which provides access to RedisContex.GetDatabase().

The graph below gives a basic idea of what my latency looks like.

Screenshot 2024-01-27 at 15-28-24 Home - Dashboards - Grafana

I have no idea how to replicate this, as it works just fine on my own dev machine (a difference VM on the same server).

The codebase is here and the packages used is here.

I'm sure that I'm doing something wrong, but I've exhausted every avenue that I can think of.

Thanks for any help you can spare!

Joseph-Melberg commented 5 months ago

Turns out the problem is that my application was thread starved. Bringing it from 4 to 8 worked like a charm.