.netdockerredisstackexchange.redislinux-containers

Performance issues with redis connections in docker linux container in .NET 5 application


Earlier I have hosted a dotnet core web application in IIS, the app interacts with Redis using StackExchange.Redis (2.0.601) client For every request, it will make a Redis get & set when throughput is more than 1k calls per minute to Redis on an average it took 1-3ms for each interaction

Now we have hosted the same app in docker Linux container and started facing latency in Redis when throughput is more than 1k calls per minute its taking 40-70ms for each Redis interaction

I tried the following things but the issue was not resolved Upgraded the StackExchange.Redis client to the latest stable version Verified if multiple connections to Redis are made (Using only one connection for all Redis interactions)


Solution

  • the issue was resolved after increasing the minimum worker threads in the thread pool

    program.cs -> ThreadPool.SetMinThreads(workerThreads, completionPortThreads);
    

    Actually, the reporting tool we are using is showing it as latency but there few redis time-outs that are happening. After increasing the worker threads even at high load the response time are under 2-3ms.