SetMinThreads not sticking on Azure Web app

Copper Contributor

We are setting the minimum threads for our asp.net app in the Application_Start using:  

System.Threading.ThreadPool.SetMinThreads(100,100)

 

This is working in our dev environment (IIS 10 box) and on our staging site (azure web app), but on our production azure web app this setting works for a few seconds or a minute or two then reverts back to the default of 4.

 

Has anyone experienced this or know of a resolution?

 

I understand this can be set from a machine.config file but we can't access that on our Azure Web App.

 

Our site gets drilled by google for indexing (our site has 250m+ pages in an online index) so we have been suffering thread starvation as the threads are just not available fast enough when we get sudden hits by Google.

 

This is very frustrating and finding any documentation on this issue has been very challenging.

 

Thanks in advance for any help!

2 Replies
Same for us. Using ThreadPool.SetMinThreads in global.asax Application_Start does not fail but also does not set any values permanently. It would be helpful for StackExchange.Redis performance and even overall performance of web app.
My latest finding is, that for "slots" the setting is permanently set on Application_Start() but not for the "main" slot of the instance.