redistimeoutexception

What does "bw: SpinningDown" mean in a RedisTimeoutException?


What does "bw: SpinningDown" mean in this error -

Timeout performing GET (5000ms), next: GET foo!bar!baz, inst: 5, qu: 0, qs: 0, aw: False, bw: SpinningDown, ....

Does it mean that the Redis server instance is spinning down, or something else?


Solution

  • It means something else actually. The abbreviation bw stands for Backlog-Writer, which contains the status of what the backlog is doing in Redis.

    For this particular status: SpinningDown, you actually left out the important bits that relate to it.

    There are 4 values being tracked for workers being Busy, Free, Min and Max. Let's take these hypothetical values: Busy=250,Free=750,Min=200,Max=1000

    In this case there are 50 more existing (busy) threads than the minimum.

    The cost of spinning up a new thread is high, especially if you hit the .NET-provided global thread pool limit. In which case only 1 new thread is created every 500ms due to throttling.

    So once the Backlog is done processing an item, instead of just exiting the thread, it will keep it in a waiting state (SpinningDown) for 5 seconds. If during that time there still is more Backlog to process, the same thread will process another item from the Backlog.

    If no Backlog item needed to be processed in those 5 seconds, the thread will be exited, which will eventually lead to a decrease in Busy (existing) threads.

    This only happens for threads above the Min count of course, as those will be kept alive even if there is no work to do.