Performance Tuning Windows 2012: Web Servers – Part 2

In this second article of the series ‘Tuning Windows 2012 – Web Servers’ we’ll discuss tuning IIS’ kernel mode.

Tuning IIS 8.0

IIS 8.0 relies on the driver http.sys which is responsible for connection management and request handling. The request can be served from the http.sys cache or passed to a worker process. When a request matches an entry in the http.sys response cache, http.sys sends the cache response directly from kernel mode.  The  ASP.NET application platform provides a mechanism so dynamic content can be cached in the kernel-mode cache. The static file handler in IIS 8.0 automatically caches frequently requested files in http.sys.




A web server has kernel-mode and user-mode components that both should be tuned for optimal performance. We’ll talk about tuning the user-mode components in out next article. For now, we’ll focus on tuning the kernel-mode components. Tuning IIS 8.0 for a specific workload includes configuring the following:


  • Http.sys (the kernel-mode web driver) and the associated kernel-mode cache
  • Worker processes and user-mode IIS, including the application pool configuration
  • Certain tuning parameters that affect performance


Let’s take a look at how to configure the kernel-mode of IIS 8.0.

Kernel-Mode Tunings


Performance-related http.sys settings fall into two categories: cache management and connection and request management. All registry settings are stored under the following registry entry:



Cache Management Settings


One benefit that http.sys provides is a kernel-mode cache. If the response is in the kernel-mode cache, you can satisfy an HTTP request entirely from the kernel mode, which significantly lowers the CPU cost of handling the request. Keep in mind that the kernel-mode cache of IIS 8.0 uses physical memory so the cost of an entry is the memory that it occupies.


An entry in the cache is helpful only when it is used. However, the entry always consumes physical memory, whether or not the entry is being used. You must evaluate the usefulness of an item in the cache (the savings from being able to serve it from the cache) and its cost (the physical memory occupied) over the lifetime of the entry by considering the available resources (CPU and physical memory) and the workload requirements. http.sys tries to keep only useful, actively accessed items in the cache, but you can increase the performance of the web server by tuning the http.sys cache for particular workloads.


The following are some useful settings for the http.sys kernel-mode cache:


  • UriEnableCache. Default value: 1.


A nonzero value enables the kernel-mode response and fragment caching. For most workloads, the cache should remain enabled. Consider disabling the cache if you expect a very low response and fragment caching.


  • UriMaxCacheMegabyteCount. Default value: 0.


A nonzero value specifies the maximum memory that is available to the kernel-mode cache. The default value, 0, enables the system to automatically adjust how much memory is available to the cache.
Note   Specifying the size sets only the maximum, and the system might not let the cache grow to the specified size.


  • UriMaxUriBytes. Default value: 262144 bytes (256 KB).


This is the maximum size of an entry in the kernel-mode cache. Responses or fragments larger than this are not cached. If you have enough memory, consider increasing the limit. If memory is limited and large entries are crowding out smaller ones, it might be helpful to lower the limit.


  • UriScavengerPeriod. Default value: 120 seconds.


The http.sys cache is periodically scanned by a scavenger, and entries that are not accessed between scavenger scans are removed. Setting the scavenger period to a high value reduces the number of scavenger scans. However, the cache memory usage might increase because older, less frequently accessed entries can remain in the cache. Setting the period too low causes more frequent scavenger scans, and it can result in too many flushes and cache churn.

Request and Connection Management Settings


Http.sys connections are automatically managed in Windows 2012. The following registry keys that were used in earlier releases are considered deprecated and are not necessary in Windows Server 2012:


  • MaxConnections  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\




  • IdleConnectionsHighMark  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\




  • IdleConnectionsLowMark  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\




  • IdleListTrimmerPeriod  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\




  • RequestBufferLookasideDepth  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\




  • InternalRequestLookasideDepth  – HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Http\





In our next article we’ll talk in depth how to tune the user-mode components of IIS 8.0.