title: How to stop or counter a timeout max pool size reached exception?
body: <p>I have set up a console .net core app (3.0.0 preview3) and have added a db context pool linked to my ef core model (2.2.4) and built the service provider</p>
  
  <pre><code>var serviceProvider = new ServiceCollection()
  .AddDbContextPool&lt;CorumClearDispenseContext&gt;(options =&gt; options.UseSqlServer("Server=.;Database=*******;Trusted_Connection=True;"))
  .BuildServiceProvider();
  </code></pre>
  
  <p>I then loop 10,000 times and make a request to the database</p>
  
  <pre><code>
  IEnumerable&lt;DataLookup&gt; searchData = null;
  
  using (var serviceScope = serviceProvider.CreateScope())
             {
                 var myDBContext = serviceScope.ServiceProvider.GetService&lt;MyDBContext&gt;();
                 searchData = await myDBContext.DataLookup.Where(p =&gt; p.Description.Contains("test")).Skip(0).Take(100).AsNoTracking().ToListAsync();
  
             }
  
  return searchData ;
  </code></pre>
  
  <p>now while running this code I always get a timeout max pool size reached exception. For clarity, the database and console app are both on the same machine.</p>
  
  <p>Could someone clarify that my understanding is correct when I say, by default I should have a pool size of 128 and that my requests are using them all and they are not finishing fast enough for the dbcontext to return to the pool by the time the next request is made?</p>
  
  <p>I am also presuming my using code is correct and it will release the resource back to the pool once leaving the using?</p>
  
  <p>What is the best approach to handle/mitigate this exception, is there any way of throttling the request until there is one available in pool?</p>