Use a dedicated thread, rather than the thread-pool, for the backlog processor by mgravell · Pull Request #1854 · StackExchange/StackExchange.Redis

added 2 commits

September 1, 2021 15:56

philon-msft

NickCraver

WeihanLi

TimLovellSmith

@mgravell

NickCraver

@NickCraver NickCraver changed the title use a dedicated thread, rather than the thread-pool, for the backlog processor Use a dedicated thread, rather than the thread-pool, for the backlog processor

Sep 2, 2021

NickCraver added a commit that referenced this pull request

Jan 17, 2022
In #1854 we switched to a Thread here to prevent the pile-up case, however under concurrent load this incurs a 10-11% penalty given backlogs aren't all that uncommon (due to the lock contention case). In .NET 6.0+, let's use the thread pool growth semantics to handle the stall case and use the cheaper Task.Run() approach.

NickCraver added a commit that referenced this pull request

Jan 18, 2022
In #1854 we switched to a `Thread` here to prevent the pile-up case, however under concurrent load this incurs a 10-11% penalty given backlogs aren't all that uncommon (due to the lock contention case). In .NET 6.0+, let's use the thread pool growth semantics to handle the stall case and use the cheaper `Task.Run()` approach.

Running the benchmarks from #1164 I was experimenting with on lock perf, I noticed a large perf sink in thread creation as a result of lock contention. For that benchmark as an example (high concurrent load) we're talking about a ~93 second -> ~84 second run reduction and similar wins in concurrent load tests.