UNC-based Caching Considerations

Applies To: Windows Server 2003, Windows Server 2003 with SP1

You should decide which caching method to use based on your network architecture and your scalability and performance requirements. In general, last-modified caching is the most reliable method. It is recommended that you use this caching method when you require scalability for a system with a Web server that points to different file structures. You can also experience performance gains by using change-notification caching if your system uses a file server that reliably reports change notifications and you have only a few sites or virtual directories. For example, if you have a single Web site with one or two applications, and all of your content is stored on a Windows Server 2003–based file server, use change-notification caching.

To configure caching for optimum scalability and performance, you must edit the registry entries MaxMpxCt, MaxWorkItems, and MaxCmds. On the server running IIS, these entries are stored in the subkey HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters. On the remote file server running Windows Server 2003, these entries are stored in the subkey HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters.

MaxMpxCt

The MaxMpxCt registry entry permits a server to provide a specified maximum number of simultaneous client requests to itself, and then enforces that limit. Because each client connection generates multiple instances (for example, Windows shell and Explorer.exe), with multiple clients connecting to the server, the number of client requests can be greater than the default MaxMpxCt value of 50. As soon as this limit is reached for that server, additional requests are refused until the number of requests drops below the limit again.

MaxWorkItems

The value of the registry entry MaxWorkItems should be at least four times as large as that for MaxMpxCt. For example, if MaxMpxCt has a value of 1,024, MaxWorkItems should have a value of at least 4,096.

Some resources, including Microsoft Knowledge Base articles, recommend setting the value of MaxWorkItems to 16,000. However, this could consume up to 250 MB of nonpaged pool memory, which could starve the system. To increase your systems reliability, it is recommended that you set the value of MaxWorkItems lower than 16,000.

To determine the number to set for the value of MaxWorkItems, monitor the Server object performance counters. The Work Item Shortages counter will indicate whether you need to make these values larger or increase the load capability of your file server by adding memory or clustering the file server. You must allow enough work items for two activities: change notifications and normal I/O requests.

MaxCmds

The MaxCmds registry entry sets the limit for the number of concurrent outstanding network requests between the SMB client and server that the client can support. The general formula for calculating the value of MaxCmds is as follows:

(number of distinct physical directories that IIS needs to monitor for change notifications) (1 (if static files exist) + 1 (if ASP content exists) + 1 (if ASP.NET content exists) + 50 (for concurrent default/regular file I/O)

This formula is merely a starting point for tuning your servers. You might need to increase your settings depending on concurrent traffic. For better scaling, you typically need to modify the values of the MaxCmds, MaxMpxCt, and MaxWorkItems registry entries on both the server running IIS and the remote file server. Before you modify the entries, however, watch the Server object performance counters while you stress-test your system. Carefully monitor the Work Item Shortages counter to see if you need to increase the values of the entries or increase the load capability of your file server by adding memory or clustering the file server. If you are using the non-default change-notification option for caching, you must allow enough work items for two activities: change notifications and normal I/O requests for the file.