Redis .net Tips and Tricks.

  1. Create a Singleton of the Redis connection multiplexer and use it everywhere.
  2. When establishing the connection to the Redis cluster, use a lock on to ensure that multiple threads don’t create the connection concurrently.
  3. 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_
  4. If you are executing Lua scripts, ensure that they are performing well using the Redis slow.
  5. 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