Redis .net Tips and Tricks.
- Create a Singleton of the Redis connection multiplexer and use it everywhere.
- When establishing the connection to the Redis cluster, use a lock on to ensure that multiple threads don’t create the connection concurrently.
- Under load of you see that Redis is timing out set ThreadPool.SetMinThreads(…) to around 250 depending on your application. More here – https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadpool.setminthreads?view=netcore-2.0#System_Threading_ThreadPool_SetMinThreads_System_Int32_System_Int32_
- If you are executing Lua scripts, ensure that they are performing well using the Redis slow.
- If you are running a Redis cluster, ensure that the BGSAVE of each node in the cluster runs at different times. If they run at once, there