Windows Server 2003 (x86) tuning for performance based on role
Yes, this is rather late in the day to start talking about W2K3 as we’ve had 2 new versions of Windows Server since then, but it’s still a widespread OS and it might be interesting to understand how to make some subtle tweaks to tailor the system resources and behaviour to suit your needs.
The three typical significant roles that I encounter servers in are:
- File Server
- Domain Controller (DC)
- Terminal Server
(The colour coding here is just to help indicate which tweaks are intended for which roles, at a glance.)
There are obviously a large number of other roles such as IIS, Exchange, Hyper-V host, etc. but for each of these I think they are outnumbered vastly by the above roles so I am going to cover those – hopefully with the details of what the changes do, you can determine whether to test altering them on your other servers.
And yes, we are focusing mainly on x86 (32-bit) servers here – once you go 64-bit a lot of these changes become irrelevant as they ceiling is raised implicitly with the extra address space.
Get your priorities right
On the context menu of My Computer, click Properties
On the System Properties window presented, select the Advanced tab, click the Settings button under Performance
On the Performance Options window presented, select the Advanced tab
Here you will see Adjust for best performance of:
- Programs
- Background services
What this setting influences is the quantum used for thread execution – how much time they get to run on a processor without interruption from threads at the same or lower priority.
For programs to appear more responsive to the user, a shorter quantum is preferred, so more context switching occurs.
Server services prefer to run without being bothered with so many context switches, so prefer a longer quantum.
A Terminal Server hosts user sessions and has many processes directly accessed by interactive users, so should have the Programs radio button selected.
A file server or DC on the other hand has little direct user interaction, so we want to extend the quantum and optimize for Background services.
The other radio button selection relating to Memory Usage toggles LargeSystemCache off (tune for programs) and on (tune for system cache) – the default is enabled on Windows Server SKUs, but again Terminal Servers can be considered “multiple user desktop” servers and so would prefer to have the workstation default, to tune for programs instead.
Dipping in the pool
For all roles, it can be useful to have the Memory Manager more aggressive when it comes to trimming paged pool allocations – by default this occurs at the 80% watermark, but this can lead to the server being unable to satisfy requests before it gets round to cleaning up – so to reduce this watermark to 60% will make the housekeeping kick in earlier:
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Name: PoolUsageMaximum
Type: REG_DWORD
Data: 60 (decimal)
For Terminal Servers it is useful to have a paged pool that is as big as possible, while an algorithm at startup determines the size of the paged pool region we do have the option to indicate that we would like it to be given preference (at the cost of Page Table Entries, PTEs):
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Name: PagedPoolSize
Type: REG_DWORD
Data: ffffffff (hexdecimal)
(This is the same setting that we recommend to make if you are getting Srv 2020 events after trying the more aggressive trimming tweak above.)
Giving to the givers (File Server & DC specific)
When it comes to file servers and DCs specifically, we want to tune for the Server (LanmanServer) service to get some love as they will be receiving many SMB connections, this can be done through some registry tweaks:
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Name: MaxWorkItems
Type: REG_DWORD
Data: 65535 (decimal)
65,535 is the maximum you can set, and this value specifies the number of receive buffers that the Server service can allocate at any time – the default is a calculation made based on system resources during startup, so we are influencing this decision to suit our needs.
These values set the minimum and maximum number of preallocated connection objects respectively:
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Name: MinFreeConnections
Type: REG_DWORD
Data: 128 (decimal)
and
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
Name: MaxFreeConnections
Type: REG_DWORD
Data: 1024 (decimal)
(This is the same setting that we recommend to make if you are getting Srv 2022 events.)
Terminal station (Terminal Server specific)
Terminal Servers act and should be treated more as “very busy clients” than servers – think about the probably of concurrent AD user logons, roaming or mandatory profile copying, files opened across the network, applications making connections to mail or database servers, and so on.
Resultant Set of Policy (RSoP) is useful for troubleshooting, but it can impact performance during “normal” operation, so it can be turned off by enabling the following group policy:
Computer Configuration / Administrative Templates / System / Group Policy / Turn off Resultant Set of Policy
Post-SP1 hotfix from KB319440 (rolled into SP2) gives control of buffering group policy reads which can improve logon times if concurrent logons are causing blocking operations when users are trying to access the same policies:
Path: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Name: BufferPolicyReads
Type: REG_DWORD
Data: 1
There is a Workstation (LanManWorkstation) service tweak which increases the number of concurrent outbound network calls:
Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters
Name: MaxCmds
Type: REG_DWORD
Data: 2048 (decimal)
Also network related, this tweak makes Explorer more responsive by cutting down on the (metadata) information queries made when browsing network shares, especially those with many, many files or folders:
Path: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Policies\Explorer
Name: NoRemoteRecursiveEvents
Type: REG_DWORD
Data: 1
Name: NoRemoteChangeNotify
Type: REG_DWORD
Data: 1
(This tweak can be pushed out to clients in a large environment as it applies to Explorer more than the concurrent user nature of Terminal Services.)
This is a very brief start at looking at what performance gains you might see on busy servers, or environments with slow/latent networks, or file servers with hundreds of thousands of files being browsed by multiple users.
Any of the registry values can be looked up on MSDN or TechNet if you’re interested in the “official” descriptions of what they do.
And as always, note any changes you make to server configurations and back up beforehand.