-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Hi,
We recently updated to the latest nuget package, and noticed our tests got 50x slower with the lastest package (2.1.58-> 2.5.61)
I narrowed down the issue to this commit
d9b3c58
After some debugging, it seems Connect times out when we reuse the same endpoint multiple times. We do this in our tests to reduce the number of redis containers needed to start (so for example, instead of having 10 separate instances, we only have 1 and configure all connection strings accordingly).
It seems to only occur with redis cluster (so not with a single standalone instance).
Reproducing is trivial (I reused an existing test here):
[Fact]
public void ThreadPoolManagerIsDetected()
{
var config = new ConfigurationOptions
{
EndPoints = { { IPAddress.Loopback, 6379 } },
SocketManager = SocketManager.ThreadPool
};
var t = new StringWriter();
using var muxer = ConnectionMultiplexer.Connect(config, log: t);
using var muxer2 = ConnectionMultiplexer.Connect(config, log: t);
using var muxer3 = ConnectionMultiplexer.Connect(config, log: t);
using var muxer4 = ConnectionMultiplexer.Connect(config, log: t);
Log(t.ToString());
Assert.Same(PipeScheduler.ThreadPool, muxer.SocketManager.Scheduler);
}
when inspecting the logs
18:39:17.7888: 172.16.255.3:7000: OnConnectedAsync already connected end
18:39:22.7858: Not all available tasks completed cleanly (from ReconfigureAsync#1744, timeout 4995ms), IOCP: (Busy=0,Free=1000,Min=12,Max=1000), WORKER: (Busy=2,Free=32765,Min=12,Max=32767), POOL: (Threads=16,QueuedItems=0,CompletedItems=403)
18:39:22.7858: Server[0] (172.16.255.2:7001) Status: RanToCompletion (inst: 12, qs: 0, in: 0, qu: 12, aw: False, in-pipe: 0, out-pipe: 0, bw: Inactive, rs: ReadAsync. ws: Idle)
18:39:22.7858: Server[1] (172.16.255.3:7000) Status: RanToCompletion (inst: 12, qs: 0, in: 0, qu: 12, aw: False, in-pipe: 0, out-pipe: 0, bw: Inactive, rs: ReadAsync. ws: Idle)
18:39:22.7858: Server[2] (172.16.255.4:6379) Status: WaitingForActivation (inst: 11, qs: 0, in: 0, qu: 11, aw: False, in-pipe: 0, out-pipe: 0, bw: Inactive, rs: ReadAsync. ws: Idle)
we see one of the tasks (sometimes its several) ends up being stuck in WaitingForActivation. This doesn't seem to happen on the initial connect.
That commit is rather large, so it's hard to know what broke.
Thanks!