Mike Lagase

Saving the Exchange world one day at a time.....

How to set System Cache upon Startup of a Windows 2003 server

How to set System Cache upon Startup of a Windows 2003 server

  • Comments 6
  • Likes

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:

    Windows 2008 schtasks help
    Windows 2003 schtasks help

  • 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.

Mike

Comments
  • PingBack from http://blogs.technet.com/mikelag/archive/2007/12/19/working-set-trimming.aspx

  • Excessive paging on Exchange 2007 servers when working sets are trimmed

  • How do i set max cache size on win2008 64bit? I tried the SetCache.exe util i found on http://blogs.msdn.com/ntdebugging/archive/2007/11/27/too-much-cache.aspx but cache just went over that setting like it wasnt even there. (yes i put a comment on that blog). Does anyone know if the Mark Russonovich util works on win2008? or some other way?

  • Unfortunately, on Windows 7, Windows completely ignores the values set by CacheSet and happily swaps all my programs to disk while it lets the cache gobble up all my RAM.

  • Thanks for sharing this information. I'm definitely going to try it on my computer at work ( http://www.esiinsurance.com/autoinsurance.html ) and here at home! I love learning new computer tricks.

  • Oh my cousin has been trying to do this all day. This makes so much more sense now that I have been listening to him all day. I am so happy I understand this a little more. www.wlwinston.com

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment