StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.88k stars 1.51k forks source link

Pipelines.Sockets.Unofficial Thread Pool #2693

Open joaooo opened 6 months ago

joaooo commented 6 months ago

Hello, im running a .net 8 app and i was profiling with dot trace and noticed a lot of the time spent is in ctor of Pipelines.Sockets.Unofficial.DedicatedThreadPoolPipeScheduler and within the .RunWorkLoop and

This is my redis DI:

IConnectionMultiplexer multiplexer = ConnectionMultiplexer.Connect(redisServer);
        services.AddSingleton(_ => multiplexer);
        services.AddStackExchangeRedisCache(o =>
        {
            o.ConnectionMultiplexerFactory = () => Task.FromResult(multiplexer);
            o.Configuration = redisServer;
        });

Also, i have 5 calls to redis, which im using WhenAll to parallel them, so im quite surprised my service is spending so much time within Pipelines.Sockets.Unofficial thread pool

image

mgravell commented 6 months ago

it is hard to say, from the outside, whether this is a problem - the work needs to happen somewhere; however, I do agree that the IO core at the moment is subptimal and hard to get insight into; I'm investing some time currently to overhaul that entire path, for this and other reasons

joaooo commented 6 months ago

Alright, thank you, i guess i will wait for the future news :)

WolframCrem commented 5 months ago

Also having this issue; Waiting for news in the future

seruss commented 1 month ago

Encountered similar issue, also waiting for updates on the matter