6

I have a SignalR solution that is deployed to an Azure Web Role (cloud service, not Azure Web Site) and in order to ensure we can maximise the number of connections to each instance I need to make some changes various ASP.NET settings as detailed in this article: http://www.asp.net/signalr/overview/performance/signalr-performance#tuning

The appConcurrentRequestLimit and requestQueueLimit settings were easily changed with a startup task that uses APPCMD to make the relevant changes. However, the maxConcurrentRequestsPerCPU setting resides in the aspnet.config file which cannot be changed via the same mechanism.

I have tried updating that file directly with a startup task (just a basic file replacement for now), however it seems to get replaced by the Azure runtime after the startup tasks have completed and so the change is lost. I can RDP into the machine and make the change manually so I have seen that it works however that is not sustainable for a service that we expect to scale up and down on demand.

Any ideas on how to change this setting in an Azure environment would be appreciated!

SomeGuyOnAComputer
  • 5,414
  • 6
  • 40
  • 72
Ben
  • 376
  • 1
  • 6
  • 1
    Perhaps you could use `ServerManager` class and alter the configuration. Didn't even begin trying this though. – sharptooth Jan 13 '15 at 09:58
  • just another blind shot: have tried replacing that file from OnStart of a RoleEntryPoint class - in web roles we can also have RoleEntryPoint implementation like we do in Worker Roles. Its instance will live in WaIISHost.exe process on the Web Role. This process is always there anyway. And OnStart will be called only after all the IIS changes are made and site is ready to run. – astaykov Jan 13 '15 at 14:00
  • Thanks both, will give those a try. Also had a suggestion on Twitter which I will try which was to add a registry DWORD named MaxConcurrentRequestsPerCPU within HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\{version} – Ben Jan 13 '15 at 14:46
  • Have you tried using Powershell to replace the value and then deploying? – Maria Ines Parnisari Jan 14 '15 at 00:13
  • 1
    "The appConcurrentRequestLimit and requestQueueLimit settings were easily changed" - `appcmd set config /section:system.webserver/serverRuntime /appConcurrentRequestLimit:100000`, `appcmd set config /section:processModel /autoConfig:false /commit:MACHINE` and `appcmd set config /section:processModel /requestQueueLimit:250000 /commit:MACHINE` – Dunc May 19 '16 at 14:01

1 Answers1

6

I ended up using the following registry based approach which allowed me to change the maxConcurrentRequestsPerCPU setting without using aspnet.config

I added the following usage of the REG command line utility to my existing startup.cmd (already in use for calling APPCMD to change other settings):

REG ADD HKLM\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0 /v MaxConcurrentRequestsPerCPU /t REG_DWORD /d 10000
REG ADD HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\4.0.30319.0 /v MaxConcurrentRequestsPerCPU /t REG_DWORD /d 10000

This will configure both 32 and 64 bit application pools, although I only needed 64 in this instance.

Ben
  • 376
  • 1
  • 6