I'm pushing some data to a Redis instance from a console app every few seconds. This is roughly how I'm doing it:
int foo = GetFoo();
BigObject bar = GetBigObject();
_cache.StringSet("Foo", JsonConvert.SerializeObject(foo));
_cache.StringSet("Bar", JsonConvert.SerializeObject(bar));
but after a while I get an exception:
StackExchange.Redis.RedisTimeoutException: 'Timeout performing SET RtSignal-op (5000ms), inst: 0, qu: 0, qs: 0, aw: False, rs: CompletePendingMessage, ws: Idle, in: 0, in-pipe: 5, out-pipe: 0, serverEndpoint: Unspecified/localhost:5002, mgr: 9 of 10 available, clientName: SVGD0083, IOCP: (Busy=0,Free=1000,Min=16,Max=1000), WORKER: (Busy=3,Free=32764,Min=16,Max=32767), v: 2.0.593.37019 (Please take a look at this article for some common client-side issues that can cause timeouts: https://stackexchange.github.io/StackExchange.Redis/Timeouts)'
In the linked to page there is a suggestion that the issue might be a result of Thread Theft and the solution is to include the following line:
ConnectionMultiplexer.SetFeatureFlag("preventthreadtheft", true);
The problem is that there doesn't seem to exist a SetFeatureFlag method in .NET framework.
Any ideas?
What is the size of your objects? If JsonConvert.SerializeObject(foo) is returning a 500MB string, then yes: you're going to have a bad day.
Also, what else is the server doing? This needs a little digging at the server, but: the redis SLOWLOG command gives you information into long-running operations. If anything is taking serious time (I'd start to get twitchy at anything that takes more than say 10 milliseconds), then your server is essentially stalling, which needs to be investigated - but that's not something the library can fix.
If you're talking to a far away server, you may want a larger timeout.
Finally, I very much doubt that this particular scenario is related to thread-theft; if anything, that sounds like you're clutching at straws (metaphorically). But if ConnectionMultiplexer.SetFeatureFlag doesn't exist, you're probably using an old library version. So: what library version are you using?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With