Optimizing Memory Usage for Exchange Server 2003

 

This topic contains information about monitoring and optimizing memory usage on your servers.

Monitoring Memory Usage

You can monitor the Event Viewer application log and Performance Logs and Alerts (Performance on the Administrative Tools submenu) for virtual memory problems. In the application log, a 9582 warning appears when the largest free block of virtual memory decreases to 32 MB. If you see this, you should restart the Exchange store process at the next opportunity. If the largest block decreases to 16 MB, a 9582 error appears again; this error means the server could fail, and you should restart the server at the earliest opportunity. Failure to act on these events could result in sporadic mail delivery and IMAIL conversion failures (12800 events).

In Performance Logs and Alerts, monitor the following counters:

  • VM Largest Block Size counter in the MSExchangeIS object: A healthy server has more than 200,000,000 bytes (200 MB) as the largest free block. If the value is lower, you should carefully monitor the server.

  • Pool Pages Bytes in the Memory object: Amounts greater than 200 MB indicate a problem except when backups are running. During backups, each page in the cache manager is backed by a pool page.

  • Pool Nonpaged Bytes in the Memory object: Amounts greater than 100 MB indicate a problem.

  • Free System Page Table Entries in the Memory object: Amounts less than 3000 indicate a problem.

  • Working Set in the Process object: An upward trend indicates a potential memory leak.

If a server shows signs of low virtual address space, you should adjust the following settings. If these settings are not optimized for Microsoft® Exchange, event 9665 appears in Event Viewer.

  • If the server is running Microsoft Windows® 2000 Advanced Server or Windows Server™ 2003 and has 1 GB or more of physical memory, set the /3GB switch in the Boot.ini file as described below.

  • If the server is running Windows Server 2003 (any edition), configure the /USERVA switch and SystemPages registry key as described below. If the server is running Windows 2000, ensure that Windows 2000 SP3 or later is installed.

  • If the server has 1 GB or more of physical memory, set the HeapDeCommitFreeBlockThreshold registry parameter as described below.

  • Tune the store database cache size if necessary as described below.

Event 9665

Exchange performs an optimal memory configuration check when the store process starts. If the memory settings are not optimal, you see event 9665 in Event Viewer. This message appears in the following instances:

  • The server is running Windows 2000 and the SystemPages value in the registry is set outside the range of 24000 to 31000.

  • The server has 1 GB of memory or more and does not have the /3GB switch.

  • The server is running Windows Server 2003, has 1 GB of memory or more and the /3GB switch is set, but the /USERVA setting is not present or not set to 3030.

If you see this event, check the SystemPages and HeapDeCommitFreeBlockThreshold settings in the registry, as well as the /3GB switch and the /USERVA setting in the Boot.ini file. The following sections contain recommendations for each of these settings.

Note

If you want to turn off the logging of event 9665, you can create the registry key shown in the following table.

Registry key to turn off memory configuration check

Path

HKLM\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem\

Parameter

Suppress Memory Configuration Notification

Type

REG_DWORD

Setting

1

Note

The memory configuration check does not occur on servers running Microsoft® Small Business Server.

Setting the /3GB Switch

By default, Windows 2000 Advanced Server and Windows Server 2003 allocate 2 GB of virtual address space to user mode processes such as Store.exe. If a server has 1 GB or more of physical memory, set the /3GB switch in the Boot.ini file to increase virtual address space.

You should only set the /3GB switch on servers that meet the following criteria:

  • The server hosts Exchange 2003 mailboxes or public folders.

  • The server has 1 GB or more of physical memory.

It is not recommended that you set this switch on Exchange servers that do not contain public folder or mailbox stores.

For more information about the /3GB switch, see Microsoft Knowledge Base article 266096, "XGEN: Exchange 2000 Requires /3GB Switch with More Than 1 Gigabyte of Physical RAM" (https://go.microsoft.com/fwlink/?linkid=3052&kbid=266096).

Important

The /3GB switch is designed for Windows 2000 Advanced Server and all editions of Windows Server 2003. Do not set the /3GB switch in Windows 2000 Standard Edition.

Configuring /USERVA and SystemPages

If the server is running Windows 2000, you should set the SystemPages registry key to a value between 24000 and 31000. The SystemPages registry key is located in the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\SystemPages

If the server is running Windows Server 2003, set the SystemPages value to zero, and set the /USERVA=3030 parameter in the Boot.ini file. These settings let you enter more system page table entries on the server, which is critical for scale-up systems.

For additional information, see Knowledge Base article 810371, "XADM: Using the /Userva Switch on Windows 2003 Server-based computers that are running Exchange Server" (https://go.microsoft.com/fwlink/?linkid=3052&kbid=810371).

Setting the HeapDeCommitFreeBlockThreshold Registry Key

The HeapDeCommitFreeBlockThreshold registry key controls the amount of free space required before the heap manager decommits (or frees up) memory. The default is zero, which means that the heap manager decommits each 4-KB page that becomes available. Over time, virtual address space can become fragmented. On servers that have 1 GB or more of physical memory, you can set the registry key to a higher value to reduce or eliminate fragmentation. Set the registry key as shown in the following table , and then restart the server. For more information about the HeapDeCommitFreeBlockThreshold registry key, see Knowledge Base article 315407, "XADM: The 'HeapDeCommitFreeBlockThreshold' Registry Key" (https://go.microsoft.com/fwlink/?linkid=3052&kbid=315407).

Settings for the HeapDeCommitFreeBlockThreshold registry key

Path

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager

Parameter

HeapDeCommitFreeBlockThreshold

Type

REG_DWORD

Default

Zero

Recommended setting*

262144

* This value is the number of blocks in decimal. The recommended value is 262144, which corresponds with a hexadecimal value of 0x00040000.

Adjusting the Store Database Cache Size

The store database cache (also referred to as the Extensible Storage Engine buffer) caches database transactions before they are committed to the database. By default, Exchange 2003 allocates 896 MB if the /3GB switch is set on the server and 576 MB if the /3GB option is not set. In the following instances, adjusting the maximum buffer size can increase performance:

  • If the server is running Exchange 2003 and other server-side applications, reduce the buffer to limit the use of memory by Exchange.

  • On servers with more than 2 GB of memory, increase the size of the buffer (up to a maximum of 1200 MB).

Before you increase the maximum buffer size, use Performance Logs and Alerts to monitor the store instance of the Virtual Bytes counter (in the Process object) under normal load. The Virtual Bytes counter shows the current size (in bytes) of the virtual address space that the Store.exe process uses. The value should be below 2.8 GB if the /3GB switch is set and below 1.8 GB if the /3GB switch is not set. If the values are higher, do not increase the maximum buffer size. If the values are lower, you can increase the maximum buffer size up to 1,200 MB. For example, if the /3GB switch is set, and the virtual bytes count is 2.5 GB under heavy load, you can increase your maximum buffer size by approximately 300 MB.

Be aware that on servers experiencing address space fragmentation issues, increasing the buffer size may negatively affect server performance. A larger buffer means more virtual address space consumption; increasing the buffer may result in system instability.

To adjust the maximum buffer size, use Active Directory Service Interface (ADSI) Edit to modify the msExchESEParamCacheSizeMax value. For more information about how to modify the msExchESEParamCacheSizeMax value, see Knowledge Base article 266768, "XSTR: How to Modify the Store Database Maximum Cache Size" (https://go.microsoft.com/fwlink/?linkid=3052&kbid=266768). After you set the value, wait for the Active Directory® directory service to replicate the value throughout the forest. Then restart the Microsoft Exchange Information Store service.

Important

Be careful not to choose the msExchESEParamCacheSizeMin value.

The following table summarizes maximum buffer size default values and recommendations. The value is expressed as a page count and should be set to an exact multiple of 8192 for maximum efficiency.

Buffer size default values and recommendations

Default size on /3GB servers

229376 (896 MB)

Default size on non /3GB servers

147456 (576 MB)

Recommended maximum

311296 (1.2 GB)

Very large address-space-constrained servers

196608 (768 MB)