Skip to content

Scripts that enable developers to modify machine.config programmatically as a startup task on Windows Azure.

Notifications You must be signed in to change notification settings

Aaronontheweb/azure-webroleperformance-scripts

Repository files navigation

Windows Azure Web Role Performance Scripts

This is a set of batch files you can include in your startup tasks if you run into performance limitations as a result of default IIS and Windows Server configuration behavior on Azure.

Inventory of Scripts

upgradeIISthreadcount.cmd – upgrades the number of the available threads for emptying the IIS request queue and increases the number of available connections per CPU.
disableAppPoolTimeout.cmd – disables the AppPool timeout recycle in IIS, which helps improve the performance of lower-traffic applications.
logIISthreadcount.cmd – logs the settings which are modified by upgradeIISthreadcount.cmd – can be modified to log other sections of machine.config as well.
setMaxProcessesToAvailableProcessors.cmd – sets the number of MaxProcesses for default app pools in IIS equal to the number of available physical processors on a machine. This is particularly useful for non-ASP.NET content types like Node.JS.
increaseTransactionTimeoutNET2.cmd – alters the maximum transaction time for .NET 2.0/3.0/3.5 apps, in Azure roles the default is 10 minutes
increaseTransactionTimeoutNET4.cmd – like the previous but for .NET 4.0 apps

Running Batch Files as Azure Startup Tasks

The recommended approach for using these scripts is to include them as Windows Azure Startup Tasks in your ServiceDefinition.csdef file.

The syntax looks like this:


    <Startup>
       <Task commandLine="[parent folder]\upgradeIISthreadcount.cmd" executionContext="elevated" taskType="background" />
        <Task commandLine="[parent folder]\disableAppPoolTimeout.cmd" executionContext="elevated" taskType="background" />
    </Startup>

All of these batch files in particular should run under executionContext="elevated" which gives them the ability to be executed with administrator permissions.

For the task type, you can use these two kinds:

  • simple, to be sure it is executed before the role start. Please note that if the script has issues it could prevent the role start;
  • background, so it executed concurrently with the role start.

In Visual Studio you’ll need to make sure that all of these individual batch files have their Copy to Output Directory setting set to “Always.”

License

These files are offered as-is to be used in any of your deployments.

USE AT YOUR OWN RISK. MAY NOT SOLVE YOUR PERFORMANCE ISSUES, but will help you manipulate machine.config should you need it.

About

Scripts that enable developers to modify machine.config programmatically as a startup task on Windows Azure.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages