How to Monitor Online Defragmentation

Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

 

Applies to: Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3

Monitoring online defragmentation enables you to verify that defragmentation of every Exchange database is completing often enough (at least every two weeks, as a best practice). Monitoring online defragmentation may also enable you to decrease the online maintenance window, which has the following advantages:

  • Allows more time for database backup.

  • Validates that online checksumming and page zeroing can be introduced within the current online maintenance window.

Microsoft Exchange Server 2007 Service Pack 1 (SP1) introduces the following improvements to help you monitor online defragmentation:

  • Extended information for Event 703 allows you to more easily monitor online defragmentation pass completions.

  • Two extended Extensible Storage Engine (ESE) performance counters for monitoring the effectiveness and efficiency of online defragmentation have been added for use with Performance Monitor (which is called Reliability and Performance Monitor in Windows Server 2008).

This topic explains how to use these two Exchange 2007 SP1 enhancements to monitor online defragmentation.

Before You Begin

Before you can use the online defragmentation performance counters, you must enable them in the registry. For information about how to enable extended ESE performance counters, see How to Enable Extended ESE Performance Counters.

To enable the extended ESE performance counters, the account you use must be delegated the following:

  • Exchange Organization Administrator permission

For more information about permissions, delegating roles, and the rights that are required to administer Exchange 2007, see Permission Considerations.

Monitoring Online Defragmentation with Event 703

Prior to Exchange 2007 SP1, you could use Event 700 (Online Defragmentation Started) and Event 703 (Online Defragmentation Completed) to monitor online defragmentation for each Exchange database. By using the Application log in Event Viewer to search for these events, you could determine how long it took to complete online defragmentation for a database. However, because this process was tedious, it was seldom performed. As a result, most administrators did not know how often online defragmentation was completing for each database.

In Exchange 2007 SP1, extended information for Event 703 allows you to more easily monitor online defragmentation pass completions. The following is a common example of Event 703 from the Application log in Event Viewer:

Event Type: Information

Event Source:ESE

Event Category: Online Defragmentation

Event ID: 703

Date: 6/20/2007

Time: 6:34:26 AM

User: N/A

Computer: CO-MBX-3

Description:

MSExchangeIS (19052) SG05: Online defragmentation has completed the resumed pass on database 'e:\MDB05\database5.edb', freeing 42794 pages. This pass started on 6/16/2007 and ran for a total of 124919 seconds, requiring 7 invocations over 4 days. Since the database was created it has been fully defragmented 14 times over 73 days.

Online defragmentation should complete at least every two weeks for every database on the server. If it completes within a two-day interval, you can safely shorten the online maintenance window.

To determine whether online defragmentation is completing often enough, you can use Event Viewer to view Event 703. The procedure you use depends on the version of Windows Server that you are running.

To use Event Viewer in Windows Server 2003 to monitor online defragmentation with Event 703

  1. Start Event Viewer. (Click Start, click Control Panel, click Administrative Tools, and then click Event Viewer.)

  2. In Event Viewer, in the console tree, click Application to view the Application log.

  3. To filter for Event 703, on the menu bar, click View, and then click the Filter tab in the Application Properties dialog box. In the Event ID box, type 703, and then click OK.

  4. To view the event description, right-click the event, and then click Properties.

To use Event Viewer in Windows Server 2008 to monitor online defragmentation with Event 703

  1. Start Event Viewer. (Click Start, point to Administrative Tools, and then click Event Viewer.)

  2. In Event Viewer, in the console tree, expand Windows Logs, and then click Application to view the Application log.

  3. To filter for Event 703, in the action pane, click Filter Current Log. The Filter Current Log dialog box appears.

  4. In the Filter Current Log dialog box, on the Filter tab, in the Includes/Excludes Event IDs box, type 703, and then click OK. All events with an ID of 703 appear in the result pane.

  5. To view the event description, right-click the event, and then click Event Properties.

For more information about using Event Viewer, see Checking the Event Viewer.

Monitoring Online Defragmentation with Performance Counters

In Exchange 2007 SP1, the following performance counters for monitoring the effectiveness and efficiency of offline defragmentation have been added for use with Performance Monitor:

  • MSExchange Database ==> Instances \Online Defrag Pages Freed/Sec   This counter shows the number of pages that are freed per second by online defragmentation due to compaction.

  • MSExchange Database ==> Instances \Online Defrag Data Moves/Sec   This counter shows the number of times per second that data is moved from one page to another by the online defragmentation process.

The following online defragmentation-specific counters that are available in the release to manufacturing (RTM) version of Exchange 2007 are also still available in Exchange 2007 SP1:

  • MSExchange Database ==> Instances\Online Defrag Average Log Bytes

  • MSExchange Database ==> Instances \Online Defrag Log Records/sec

  • MSExchange Database ==> Instances \Online Defrag Pages Dirtied/sec

  • MSExchange Database ==> Instances \Online Defrag Pages Preread/sec

  • MSExchange Database ==> Instances \Online Defrag Pages Read/sec

  • MSExchange Database ==> Instances \Online Defrag Pages Re-Dirtied/sec

  • MSExchange Database ==> Instances \Online Defrag Pages Referenced/sec

By logging the MSExchangeDatabase\Online Defrag Pages Freed/Sec counter and the MSExchangeDatabase\Online Defrag Pages Read/sec counter for each database during the online maintenance period and then comparing the ratio of the averages of the two values during the defragmentation period, you can measure the efficiency of online defragmentation and determine if the online defragmentation window can be reduced in size:

  • If the read-to-freed ratio is greater than 100:1, the online defragmentation window can be reduced.

  • If the read-to-freed ratio is less than 50:1, the online defragmentation window should be increased.

For example, if the average value for Online Defrag Pages Read/sec equals 3275, and the average value for Online Defrag Pages Freed/Sec equals 28, the ratio is 117:1 and the online defragmentation window can be reduced.

The ratio is a measure of the efficiency of the online defragmentation process and of the benefit that it provides. The goal is to balance the database read input/output (I/O) (which is required to analyze a database for online defragmentation) with the actual database compaction work (the database write I/O based on the work that is performed by the defragmentation process). That is, the goal is to find a balance between performing the defragmentation analysis and performing the actual defragmentation.

To use the extended ESE performance counters to monitor online defragmentation

  1. Enable extended ESE performance counters. For information about how to enable extended ESE performance counters, see How to Enable Extended ESE Performance Counters.

  2. To start Performance Monitor (Windows Server 2003) or Reliability and Performance Monitor (Windows Server 2008), click Start, click Run, and then type PerfMon.

  3. Create a counter log that logs the MSExchange Database ==> Instances\Online Defrag Pages Freed/Sec and MSExchangeDatabase ==> Instances \Online Defrag Pages Read/sec counters for the storage groups that you want to monitor. For information about how to log counters, see one of the following Windows Server Help topics:

    • Windows Server 2008: "Creating Data Collector Sets" in Reliability and Performance Monitor Help.

    • Windows Server 2003: Create a Counter Log in Performance Monitor Help.

  4. Schedule the counter log to run during online defragmentation and to sample data at 60-second intervals.

  5. Review the log and determine the average values of both counters during the defragmentation period.

  6. Divide the average Read value by the average Freed value. If the read-to-freed ratio is greater than 100:1, you can reduce the online defragmentation window. If the read-to-freed ratio is less than 50:1, you should increase the online defragmentation window.

Note   You can use the Exchange Management Shell to get the online maintenance window for a database. For example, to get information about a mailbox database, use the following command: GetMailboxDatabase -Identity <database> | FL. Alternatively, in the Exchange Management Console, you can right-click a database, click Properties, and then view the Maintenance schedule list on the General tab.

For More Information

For more information about monitoring server performance, see Monitoring Server Performance.