In certain scenarios on Exchange 2007 servers, there may be the need to set the System File Cache on a server to prevent working set trimming scenarios due to other applications or processes running on the server. This can be any application or process that makes use of this Cache on the server. Note: This blog entry was created as a reference in http://blogs.technet.com/mikelag/archive/2007/12/19/working-set-trimming.aspx.
Here are the steps how to do this.
- Create a directory on your server to house the startup batch file. (Ex. c:\batch_files)
- Download Cacheset from http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx and extract it to the directory above.
- Run Cacheset
- Note the minimum working set value on the server (For Example, 1980 KB)
- Close Cacheset
- Calculate the maximum value by taking 10% of Physical RAM. You can use an online tool such as http://www.calculateme.com/ComputerStorage/Gigabytes/ToKilobytes.htm for help with determining this to simplify things. (For Example, if you had 24GB of physical RAM in the server, the value would be 25165824)
- Create a batch file with the following contents and save it as setcache.cmd in the above directory
C:\batch_files\cacheset.exe 1980 25165824
- Since setting the cache using this utility does not survive a reboot, we need to find a way to enable this upon startup. We can do this with the built-in Schtasks utility that is part of Windows 2003. Open a command prompt and type the following:
schtasks /create /tn "Set Cache On Startup" /tr "c:\batch_files\setcache.cmd" /sc onstart /ru ""
Note: Specifying "" for the /RU switch, tells the task to run as SYSTEM.
More information regarding this tool can be found in the following locations:
- Before we can run cacheset using SYSTEM rights, we need to bypass the EULA acceptance, otherwise the utility will hang upon starting waiting for you to click the Accept button and this procedure will not work.. To workaround this, open up a command prompt interactively following these steps
- Open a command prompt
- Note the current time in military time. For example, if it is 4PM, then this equates to 16:00.
- Type at 16:01 /interactive cmd.exe making sure that the time you enter is at least one minute past the current time.
- Wait for the command window to open.
- Type c:\batch_files\cacheset.exe and accept the EULA.
- Close the command prompt.
- To verify that the scheduled task has been added properly, type schtasks from a command prompt. This should return the 'TaskName" and the "Next Run Time" of "At system start up"
- Reboot the server
- If all went well, run the cacheset.exe utility manually to ensure that the cache size is set accordingly. The minimum and maximum values should match what you added in the setcache.cmd file.