
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
-
Enable extended ESE performance counters. For information about how to enable extended ESE performance counters, see How to Enable Extended ESE Performance Counters.
-
To start Performance Monitor (Windows Server 2003) or Reliability and Performance Monitor (Windows Server 2008), click Start, click Run, and then type PerfMon.
-
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.
-
Schedule the counter log to run during online defragmentation and to sample data at 60-second intervals.
-
Review the log and determine the average values of both counters during the defragmentation period.
-
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.