Performance Tuning IIS 6/7

Add a comment April 29th, 2010

Architecture

This section contains information about configuration, topology, and other aspects to consider for Web servers serving highly performing IIS applications.

Use Kerberos authentication for servers with heavy usage.

We recommend that you use Kerberos authentication for servers in which you serve many requests for a given time unit, if so doing so meets other business needs. Kerberos authentication can return authentication request results quickly because it uses caching.

Tuning

This section contains information about configuration, end-user training, maintenance, and other recommendations for optimizing existing IIS application servers.

Configure application pool recycling settings for better availability

Use the guidance in this section to tune your application pools for improved availability.

  • If you have multiple Web servers in your farm, be sure that the application pools are set to recycle at different times on each Web server.
  • Recycle IIS Web sites at different times to spread loads across all Web servers in the farm. If you need to recycle more than one application pool on a specific Web site at the same time, you should temporarily remove that Web server from the load balancer to avoid poor performance during the recycling process.
  • When you plan application pool recycling on servers, consider the amount of memory used by each application pool and revise the frequency of recycling based on the amount of memory used. Application pools that use fewer memory resources will need fewer recycles than application pools that use more memory.

Memory management is recommended to schedule nightly recycle of application pools for 64-bit servers. This helps reduce the possibility of problems caused by fragmentation.

  • Use IIS overlapped recycling

Regularly restarting the worker process can help reduce the fragmentation in the address space. This makes the process more robust and efficient. The overlapped recycling feature in IIS can be used to recycle the application worker process gracefully. This gives existing user requests time to be completed. Prior to stopping and restarting the existing process, a new process is started that takes all new requests. The old process is shut down when all existing requests are met or the shut-down time limit is exceeded.

For best results, you should set IIS to recycle at specific times, and when memory usage reaches specific levels.

  • Configure a virtual memory-based recycle to occur at 1700 MB.
  • Configure the memory-used recycle to occur at 1000 MB.
  • Set the shutdown time limit to at least 300 seconds to give long-running user requests, such as large file uploads, an opportunity to be completed.
  • Use time-based recycles in environments that have regular heavy loads at certain periods of the day. Set a scheduled recycle about 30 minutes before the peak traffic starts.

Failure to configure these settings on servers might have an adverse effect on ASP.NET cache management. If you do not set a process memory limit, ASP.NET will calculate one for you. If the user mode address space is 2 GB, ASP.NET will use the lesser value of either 60% physical RAM or 800 MB. This value will be used to determine how aggressively the cache should clean up memory. Setting this value too low might result in too many memory cleanup operations. Setting it too high lets the process to grow too large and cause OutOfMemory exceptions and other errors.

For more information about recycling worker processes, see Configuring Worker Processes for Recycling (http://go.microsoft.com/fwlink/?LinkId=105924&clcid=0x409).

  • Enable the LogEventOnRecycle IIS metabase property to track process recycling

To track how often worker processes are recycling, you can use the LogEventOnRecycle property in the Internet Information Services (IIS) 6.0 metabase to generate entries in the system event log. If you find that these processes are recycling more frequently than every 4 hours, consider adding more Web servers to handle to the load.

You can set the flags by using Adsutil.vbs. To write the causes of all application pool processes to the event log, follow these steps:

  1. Click Start, click Run, type cmd, and then press ENTER.
  2. Change to the directory where Adsutil is located. The following is the default directory location: %SYSTEMDRIVE%\Inetpub\AdminScripts
  3. Type the following command, and then press ENTER:

cscript adsutil.vbs Set w3svc/AppPools/ <YourAppPoolName> /LogEventOnRecycle 255Application - 80/LogEventOnRecycle" 255

In this command, replace YourAppPoolName with the name of the application pool on which you want to enable the events

Note:

If the application pool name has a space in it, for example, “Application – 80”, you must use double quotation marks around the metabase path in the command, as shown in the following example.

cscript adsutil.vbs Set "w3svc/AppPools/

For more information, see How to modify Application Pool Recycling events in IIS 6.0 (http://go.microsoft.com/fwlink/?LinkId=105925&clcid=0x409).

Enabling HTTP Compression (IIS 6.0)You can enable HTTP compression server-wide or on a specific directory. HTTP compression improves bandwidth utilization and speeds up Web site performance. In addition, you can compress static or dynamic responses.

Important

You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type runas /user:Administrative_AccountName“mmc %systemroot%\system32\inetsrv\iis.msc”.

Procedures

To enable global HTTP compression by using IIS Manager:

  1. In IIS Manager, double-click the local computer, right-click the Web Sites folder, and then click Properties.
  2. Click theService tab, and in the HTTP compression section, select the Compress application files check box to enable compression for dynamic files.
  3. Select the Compress static files check box to enable compression for static files.
  4. In the Temporary directory box, type the path to a local directory or click Browse to locate a directory. Once a static file is compressed, it is cached in this temporary directory until it expires, or the content changes. The directory must be on the local drive of an NTFS–formatted partition. The directory cannot be compressed or shared, and the access control lists (ACLs) for the directory must include Full Control access to the identity of the application pool or to the IIS_WPG group.
  5. Under Maximum temporary directory size, click a folder size option. If you specify a maximum size under Limited to (in megabytes) (the default setting is 95 MB), then when the limit is reached, IIS automatically cleans up the temporary directory by applying the “least recently used” rule.
  6. Click Apply, and then click OK.

Important

You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /user:MyComputer\Administratorcmd to open a command window with administrator rights and then type cscript.exeScriptName (include the script’s full path and any parameters).

To enable global HTTP compression by using Adsutil.vbs

  1. Open a command prompt.
  2. To enable dynamic compression, type the following at the command prompt and then press ENTER:
cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true

 

  1. To enable static compression, type the following at the command prompt and then press ENTER:
cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true

 

To enable HTTP Compression for Individual Sites and Site Elements

Disable global static compression by executing the following command at a command prompt:

adsutil set w3svc/filters/compression/parameters/HcDoStaticCompression false

 

Enable static compression at this directory by executing the following command at a command prompt:

adsutil set w3svc/1/root/Home/StyleSheets/DoStaticCompression true

 

To disable static compression for only a single directory, first enable global static compression (if it is disabled) and then disable static compression at that directory. For example, to enable static compression for a directory at http://www.contoso.com/Home/StyleSheets, perform the following steps:

  1. Disable global static compression by executing the following command at a command prompt: adsutil set w3svc/filters/compression/parameters/HcDoStaticCompression true
  2. Enable static compression at this directory by executing the following command at a command prompt: adsutil set w3svc/1/root/Home/StyleSheets/DoStaticCompression false

Procedures

To add one or more file types to the server-wide static compression configuration

  1. From the Start menu, click Run.
  2. In the Open box, type cmd, and click OK.
  3. Type both of the following commands:
cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcFileExtensions "htm html txt newext" where newext is a file type you want to compress, then press ENTER. You can add multiple file types separated by spaces.

cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcFileExtensions "htm html txt newext" where newext is a file type you want to compress, then press ENTER. You can add multiple file types separated by spaces.

Note

To remove one or more file types from the server-wide static compression configuration, repeat the previous two commands, leaving out the file type you want to remove.

To add one or more file types to the server-wide dynamic compression configuration

  1. From the Start menu, click Run.
  2. In the Open box, type cmd, and click OK.
  3. Type both of the following commands:
cscript adsutil.vbs SET W3SVC/Filters/Compression/Deflate/HcScriptFileExtensions "asp dll exe newext" where newext is a file type you want to compress (for example, aspx, a commonly used ASP extension), then press ENTER. You can add multiple file types separated by spaces.

cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp dll exe newext" where newext is a file type you want to compress, then press ENTER. You can add multiple file types separated by spaces.

Enabling HTTP Keep-Alives (IIS 6.0)

Most Web browsers request that the server keep the client connection open while the server sends multiple elements (.htm files and .gif or .jpeg files) to the client. Keeping the client connection open in this way is referred to as an HTTP Keep-Alive. Keep-Alive is an HTTP specification that improves server performance. HTTP Keep-Alives are enabled by default.

Important

You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type:

runas /user:Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc"

 

Procedures

To enable HTTP Keep-Alives

  1. In IIS Manager, expand the local computer, expand the Web Sites folder, right-click the Web site, and click Properties.
  2. On the Web Site tab, in the Connections section, click the Enable HTTP Keep-Alives check box.
  3. Click Apply, and then click OK.

Enable CPU Monitoring

Enable CPU monitoring to monitor and to automatically shut down worker processes that consume large amounts of CPU time. To enable CPU monitoring, follow these steps:

  1. In Internet Information Services (IIS) Manager, expand the local computer, expand the Application Pools folder, right-click the application pool that you want to enable CPU accounting on, and then click Properties.
  2. Click the Performance tab, and then click to select the Enable CPU monitoring check box.
  3. In the Maximum CPU use box, click the up and down arrows to set the maximum percentage of the CPU that you want the application pool to use.If the application pool uses more than the designated maximum, IIS generates an error message in the Windows Events log.
  4. In the Refresh CPU usage numbers (in minutes) box, click the up and down arrows to set the refresh rate.
  5. In the Action performed when CPU usage exceeds maximum CPU use box, click the appropriate action for the designated application pool:
  • Click No Action to have IIS generate an error in the Windows Events Log when the designated application pool reaches the maximum CPU usage.
  • Click Shutdown to shut down the application pool. Click Shutdown to stop the problematic application by terminating its host worker process.

6. Click Apply, and then click OK.

  1. March 11th, 2013 at 07:13 | #1

    My coder is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress
    on various websites for about a year and am anxious about switching to another platform.

    I have heard fantastic things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any help would be greatly appreciated!

    Have a look at my homepage … http://www.dpl.ca

  2. June 17th, 2014 at 21:18 | #2

    What’s up mates, its impressive piece of writing on the topic of educationand fully defined, keep it up all the time.

  3. July 10th, 2014 at 13:42 | #3

    I see a lot of interesting posts on your page. You have to spend a lot of time
    writing, i know how to save you a lot of time, there is a tool that creates unique, google friendly posts in couple of
    seconds, just search in google – k2 unlimited content

  4. September 19th, 2014 at 04:44 | #4

    Right here is the right blog for anybody who hopes
    to find out about this topic. You know so much its almost hard to argue with you (not
    that I personally will need to…HaHa). You definitely put a fresh spin on a subject which has been written about for ages.
    Great stuff, just wonderful!

  5. September 22nd, 2014 at 18:52 | #5

    Useful info. Lucky me I discovered your site by accident, and I am shocked
    why this twist of fate didn’t came about earlier! I bookmarked it.

  6. September 23rd, 2014 at 06:56 | #6

    I got this website from my buddy who informed me concerning this web site and at the moment this
    time I am browsing this website and reading very
    informative articles at this place.

  7. September 26th, 2014 at 21:17 | #7

    Appreciating the hard work you put into your blog and detailed
    information you provide. It’s good to come across a blog every once in a while that isn’t the same old rehashed information. Wonderful
    read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  8. January 11th, 2015 at 10:41 | #8

    WHOLIS.

  9. January 11th, 2015 at 11:57 | #9

    5. Consider All the Stakeholders Affected by
    the System.

  10. January 15th, 2015 at 12:11 | #10

    Training for threat internally could be a huge benefit for dealing with external danger.

  11. January 19th, 2015 at 06:06 | #11

    Fantastic items from you, man. I’ve take note your stuff prior to and
    you’re simply extremely excellent. I actually like what you’ve received right here,
    certainly like what you’re stating and the best
    way by which you assert it. You make it entertaining and you continue to
    care for to stay it smart. I can’t wait to read far more from you.
    That is actually a wonderful website.

  12. January 19th, 2015 at 19:52 | #12

    Our world is obsessed with the idea of being thin.

  1. No trackbacks yet.
Comments feed