4

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?

2

2 Answers 2

3

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your input! Much appreciated. The object is not even close to 500MB. A few Kb at the most. Redis is running in docker, and the client writing the data is just calling StringSet every few seconds. Both client and Redis is running on the same machine. It's actually been running quite a while without the error popping up, a few hours maybe
0

StackExchange.Redis is not part of the .net framework.

_cache probably is the StackExchange.Redis.IDatabase object type. So, just add the line where you initialize redis support at your application - probably at startup.cs.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.