• User-Mode Cache Behavior Settings
  • Compression Behavior Settings
  • Tuning the Default Document List
  • Application and Site Tunings
  • Managing IIS 7.5 Modules
  • ASP.NET Concurrency Setting
  • Worker Process and Recycling Options
  • Secure Sockets Layer Tuning Parameters
  • Managed Code Tuning Guidelines
  • Performance Tuning Guidelines for Windows Server 2008 R2 April 12, 2013 Abstract

    Download 0.5 Mb.
    Hajmi0.5 Mb.
    1   ...   5   6   7   8   9   10   11   12   ...   24

    User-Mode Settings

    The settings in this section affect the IIS 7.5 worker process behavior. Most of these settings can be found in the %SystemRoot%\system32\inetsrv\config
    \applicationHost.config XML configuration file. Use either Appcmd.exe or the IIS 7.5 management console to change them. Most settings are automatically detected and do not require a restart of the IIS 7.5 worker processes or Web Application Server.

    User-Mode Cache Behavior Settings

    This section describes the settings that affect caching behavior in IIS 7.5. The user-mode cache is implemented as a module that listens to the global caching events that the integrated pipeline raises. To completely disable the user-mode cache, remove the FileCacheModule (Cachfile.dll) module from the list of installed modules in the system.webServer/globalModules configuration section in applicationHost.config.






    Disables the user-mode IIS cache when set to false. When the cache hit rate is very small, you can disable the cache completely to avoid the overhead that is associated with the cache code path. Disabling the user-mode cache does not disable the kernel-mode cache.



    Disables the kernel-mode cache when set to false.



    Limits the IIS user-mode cache size to the specified size in megabytes. IIS adjusts the default depending on available memory. Choose the value carefully based on the size of the hot set (the set of frequently accessed files) versus the amount of RAM or the IIS process address space, which is limited to 2 GB on 32-bit systems.



    Lets files up to the specified size be cached. The actual value depends on the number and size of the largest files in the dataset versus the available RAM. Caching large, frequently requested files can reduce CPU usage, disk access, and associated latencies. The default value is 256 KB.


    Compression Behavior Settings

    In Windows Server 2008 R2, IIS 7.5 compresses static content by default. Also, compression of dynamic content is enabled by default when the DynamicCompressionModule is installed. Compression reduces bandwidth usage but increases CPU usage. Compressed content is cached in the kernel-mode cache if possible. IIS 7.5 lets compression be controlled independently for static and dynamic content. Static content typically refers to content that does not change, such as GIF or HTM files. Dynamic content is typically generated by scripts or code on the server, that is, ASP.NET pages. You can customize the classification of any particular extension as static or dynamic.

    To completely disable compression, remove StaticCompressionModule and DynamicCompressionModule from the list of modules in the system.webServer/globalModules section in applicationHost.config.









    Enables or disables compression if the current percentage CPU usage goes above or below specified limits.

    IIS 7.5 automatically disables compression if steady-state CPU increases above the disable threshold. Compression is re-enabled if CPU drops below the enable threshold.

    50, 100, 50, and 90 respectively


    Specifies the directory in which compressed versions of static files are temporarily stored and cached. Consider moving this directory off the system drive if it is accessed frequently.

    The default value is %SystemDrive%\inetpub\temp

    \IIS Temporary Compressed Files.

    See Description column


    Specifies whether a limit exists for how much disk space all compressed files, which are stored in the compression directory that is specified by directory, can occupy.



    Specifies the number of bytes of disk space that compressed files can occupy in the compression directory.

    This setting might need to be increased if the total size of all compressed content is too large.

    100 MB






    Specifies whether static content is compressed.



    Specifies whether dynamic content is compressed.

    True (changed in Windows Server 2008 R2)

    Note: For IIS 7.5 servers that have low average CPU usage, consider enabling compression for dynamic content, especially if responses are large. This should first be done in a test environment to assess the effect on the CPU usage from the baseline.

    Tuning the Default Document List

    The default document module handles HTTP requests for the root of a directory and translates them into requests for a specific file, such as Default.htm or Index.htm. On average, around 25 percent of all requests on the Internet go through the default document path. This varies significantly for individual sites. When an HTTP request does not specify a file name, the default document module linearly walks the list of allowed default documents, searching for each one in the file system. This can adversely affect performance, especially if reaching the content requires making a network round trip or touching a disk.

    You can avoid the overhead by selectively disabling default documents and by reducing or ordering the list of documents. For Web sites that use a default document, you should reduce the list to only the default document types that are used. Additionally, order the list so that it begins with the most frequently accessed default document file name. Finally, you can selectively set the default document behavior on particular URLs by using custom configuration inside a location tag in applicationHost.config or by inserting a Web.config file directly in the content directory. This allows a hybrid approach, which will enable default documents only where they are necessary and will set the list to the correct file name for each URL.

    To disable default documents completely, remove DefaultDocumentModule from the list of modules in the system.webServer/globalModules section in applicationHost.config.






    Specifies that default documents are enabled.



    Specifies the file names that are configured as default documents.

    The default list is Default.htm, Default.asp, Index.htm, Index.html, Iisstart.htm, and Default.aspx.

    See Description column

    Central Binary Logging

    Binary IIS logging reduces CPU usage, disk I/O, and disk space usage. Central binary logging is directed to a single file in binary format, regardless of the number of hosted sites. Parsing binary-format logs requires a post-processing tool.

    You can enable central binary logging by setting the centralLogFileMode attribute to CentralBinary and setting the enabled attribute to True. Consider moving the location of the central log file off the system partition and onto a dedicated logging partition to avoid contention between system activities and logging activities.






    Specifies the logging mode for a server. Change this value to CentralBinary to enable central binary logging.







    Specifies whether central binary logging is enabled.



    Specifies the directory where log entries are written.

    The default directory is: %SystemDrive%\inetpub\logs\LogFiles

    See Des-cription column

    Application and Site Tunings

    The following settings relate to application pool and site tunings.






    Indicates to the Universal Listener how many requests are queued for an application pool before future requests are rejected. When the value for this property is exceeded, IIS rejects subsequent requests with a 503 error.

    Consider increasing this for applications that communicate with high-latency back-end data stores if 503 errors are observed.



    When True, enables a 32-bit application to run on a computer that has a 64-bit processor.

    Consider enabling 32-bit mode if memory consumption is a concern. Because pointer sizes and instruction sizes are smaller, 32-bit applications use less memory than 64-bit applications. The drawback to running 32-bit applications on a 64-bit machine is that user-mode address space is limited to 4 GB.







    Specifies whether IIS looks for Web.config files in content directories lower than the current level (True) or does not look for Web.config files in content directories lower than the current level (False).

    When configuration is queried in the IIS 7.5 pipeline, it is not known whether a URL (/.htm) is a reference to a directory or a file name. By default, IIS 7.5 must assume that /.htm is a reference to a directory and search for configuration in a /.htm/web.config file. This results in an additional file system operation that can be costly.

    By imposing a simple limitation, which allows configuration only in virtual directories, IIS 7.5 can then know that unless /.htm is a virtual directory it should not look for a configuration file. Skipping the additional file operations can significantly improve performance to Web sites that have a very large set of randomly accessed static content.


    Managing IIS 7.5 Modules

    IIS 7.5 has been refactored into multiple, user-pluggable modules to support a more modular structure. This refactorization has a small cost. For each module present, the integrated pipeline must call into the module for every event that is relevant to the module. This happens regardless of whether the module must do any work. You can conserve CPU cycles and memory by removing all modules that are not relevant to a particular Web site.

    A Web server that is tuned only for simple static files might include only the following five modules: UriCacheModule, HttpCacheModule, StaticFileModule, AnonymousAuthenticationModule, and HttpLoggingModule.

    To remove modules from applicationHost.config, remove all references to the module from the system.webServer/handlers and system.webServer/modules sections in addition to the module declaration in system.webServer/globalModules.

    Classic ASP Settings

    The following settings apply only to classic ASP pages and do not affect ASP.NET settings. For performance recommendations on ASP.NET, see the article about high-performance Web applications in "Resources" later in this guide.






    This attribute contains the name of the directory that ASP uses to store compiled ASP templates to disk after overflow of the in-memory cache.

    Recommendation: If possible, set to a platter not in heavy use, for example, not shared with the operating system, pagefile, IIS log, or other frequently accessed content.

    The default directory is: %SystemDrive%\inetpub\temp
    \ASP Compiled Templates

    See Description column


    This attribute specifies the maximum number of compiled ASP templates that can be stored.

    Recommendation: Set to the maximum value of 0x7FFFFFFF.



    This attribute specifies the number of precompiled script files to cache.

    Recommendation: Set to as many ASP templates as memory limits allow.



    This attribute specifies the maximum number of scripting engines that ASP pages will keep cached in memory.

    Recommendation: Set to as many script engines as memory limits allow.







    Specifies the maximum number of worker threads per processor that ASP can create. Increase if the current setting is insufficient to handle the load, possibly causing errors when it is serving some requests or under-usage of CPU resources.







    Set to True if errors or failures are detected while it is serving some ASP content. This can occur, for example, when hosting multiple isolated sites in which each site runs under its own worker process. Errors are typically reported from COM in the Event Viewer. This setting enables the multithreaded apartment model in ASP.


    ASP.NET Concurrency Setting

    By default, ASP.NET limits request concurrency to reduce steady-state memory consumption on the server. High concurrency applications might need to adjust some settings to improve overall performance. These settings are stored under the following registry entry:


    The following setting is useful for fully using resources on a system:

    MaxConcurrentRequestPerCpu. Default value 12.

    This setting limits the maximum number of concurrently executing ASP.NET requests on a system. The default value is conservative to reduce memory consumption of ASP.NET applications. Consider increasing this limit on systems that run applications that perform long, synchronous I/O operations. Otherwise, users can experience high latency because of queuing or request failures from exceeding queue limits under high load with the default setting.

    Worker Process and Recycling Options

    The options for recycling IIS worker processes under the IIS Administrator user interface provide practical solutions to acute situations or events without requiring intervention, a service reset, or even a computer reset. Such situations and events include memory leaks, increasing memory load, or unresponsive or idle worker processes. Under ordinary conditions, recycling options might not be needed and can be turned off or the system can be configured to recycle very infrequently.

    You can enable process recycling for a particular application by adding attributes to the recycling/periodicRestart element. The recycle event can be triggered by several events including memory usage, a fixed number of requests, and a fixed time period. When a worker process is recycled, the queued and executing requests are drained and a new process is simultaneously started to service new requests. The periodicRestart element is per-application, meaning that each attribute in the table below will be partitioned on a per-application basis.






    Enable process recycling if virtual memory consumption exceeds the specified limit in kilobytes. This is a useful setting for 32-bit machines that have a small, 2-GB address space to avoid failed requests because of out-of-memory errors.



    Enable process recycling if private memory allocations exceed a specified limit in kilobytes.



    Enable process recycling after a certain number of requests.



    Enable process recycling after a specified time period. (The default is 29 hours.)


    Secure Sockets Layer Tuning Parameters

    The use of secure sockets layer (SSL) imposes additional CPU cost. The most expensive component of SSL is the session establishment cost (involving a full handshake), and then reconnection cost and encryption/decryption cost. For better SSL performance, do the following:

    Enable keep-alives for SSL sessions. This eliminates the session establishment costs.

    Reuse sessions when appropriate, especially with non-keep-alive traffic.

    Note that larger keys provide more security but also use more CPU time.

    Note that not all components of your page might need to be encrypted. However, mixing plain HTTP and HTTPS might result in a pop-up warning on the client browser that not all content on the page is secure.


    No special tuning parameters are needed for the Internet Server API (ISAPI) applications. If writing a private ISAPI extension, make sure that you code it efficiently for performance and resource use. See also “Other Issues that Affect IIS Performance” later in this guide.

    Managed Code Tuning Guidelines

    The new integrated pipeline model in IIS 7.5 enables a high degree of flexibility and extensibility. Custom modules that are implemented in native or managed code can be inserted into the pipeline or can replace existing modules. Although this extensibility model offers convenience and simplicity, you should be careful before you insert new managed modules that hook into global events. Adding a global managed module means that all requests, including static file requests, must touch managed code. Custom modules are susceptible to events such as garbage collection in addition to adding significant CPU cost because of marshaling data between native and managed code. If possible, you should implement global modules in native (C/C ) code.

    When you first deploy an ASP.NET Web site, make sure that you precompile all scripts. You can do this by calling one .NET script in each directory. Reset IIS after compilation is complete. Recompile after changes to Machine.config, Web.config, or any .aspx script.

    If session state is not needed, make sure that you turn it off for each page.

    When you run multiple hosts that contain ASP.NET scripts in isolated mode (one application pool per site), monitor the memory usage. Make sure that the server that runs has enough RAM for the expected number of concurrently running application pools. Consider using multiple application domains instead of multiple isolated processes.

    For performance recommendations on ASP.NET, see the article about high-performance web applications in "Resources" later in this guide.

    Download 0.5 Mb.
    1   ...   5   6   7   8   9   10   11   12   ...   24

    Download 0.5 Mb.

    Bosh sahifa

        Bosh sahifa

    Performance Tuning Guidelines for Windows Server 2008 R2 April 12, 2013 Abstract

    Download 0.5 Mb.