title: StackExchange Redis Timeouts and how to set my Minimum Thread Pool Number in .NET Core?
body: <p>I am getting the following error when trying to query a very simple string (my application log level) from my azure redis cache that just suddenly appeared in my production environment (this query occurs frequently):</p>
  
  <blockquote>
    <p>Failed to deserialize loglevel from Redis Cache: Timeout performing
    GET (5000ms), next: GET LoggingLevel:ApplicationAPI, inst: 2, qu: 0,
    qs: 1289, aw: False, rs: ReadAsync, ws: Idle, in: 130355,
    serverEndpoint: XXXX mgr:
    10 of 10 available, clientName: application-api-67cdbb4cfd-lkqdk,
    IOCP: (Busy=0,Free=1000,Min=1,Max=1000), WORKER:
    (Busy=3515,Free=29252,Min=1,Max=32767), v: 2.0.601.3402 (Please take a
    look at this article for some common client-side issues that can cause
    timeouts:
    <a href="https://stackexchange.github.io/StackExchange.Redis/Timeouts" rel="noreferrer">https://stackexchange.github.io/StackExchange.Redis/Timeouts</a>)</p>
  </blockquote>
  
  <p>I have read the thread that they are suggesting and I have also have read <a href="https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/cache-how-to-troubleshoot#burst-of-traffic" rel="noreferrer">How to troubleshoot Azure Cache for Redi</a>s</p>
  
  <p>Based on the metrics I have read in Azure dashboard, I do not believe I am exceeding my current memory or connection limits. It seems to have to do with my number of worker threads set in the thread pool. I am reading that I should: </p>
  
  <blockquote>
    <p>"set the minimum configuration value for IOCP and WORKER threads to
    something larger than the default value"</p>
  </blockquote>
  
  <p>I have also read that I can set my min thread count using <code>ThreadPool.SetMinThreads(Int32, Int32)</code> api in .NET Core.</p>
  
  <p>So basically my questions are:</p>
  
  <ol>
  <li>Is it safe to set my min thread pool when running my application in an AKS cluster?</li>
  <li>Where should I set this value? In Program.cs? In Startup.cs?</li>
  <li>Based on the log I saw above would it be safe to set my min level to 4000 ? So I am above the Busy threshold for Worker threads?</li>
  </ol>