Conclusion
ACT is a powerful tool, and you can only expect its capabilities to expand with future releases as it changes to accommodate new technology. Given the importance of stress testing, it behooves you to become familiar with a stress tool such as ACT. The sooner you learn the tool, the sooner you will be able to put it to good use. We hope this chapter helped provide a quick start to becoming productive with ACT.
Chapter 4
Monitoring Application Performance with System Monitor
The Microsoft Windows 2000 family of servers provides a graphical performance-monitoring tool called System Monitor, which is a Microsoft Management Console (MMC) snap-in. (It was called Performance Monitor, or Perfmon, in previous versions of Windows NT.) This snap-in assists you with monitoring the performance of your Web applications, database systems, and hardware resources on Windows-based servers. MMC has two
In this chapter we discuss how to use the MMC snap-in, which resources to monitor, and how to interpret some of the most common system counters. Performance objects and counters specific to the .NET Framework are discussed in Chapter 7, ASP.NET and IIS counters and objects are detailed in Chapter 6, and SQL Server “specific counters and objects in Chapter 8. Note that we refer to the Windows 2000 server family in this chapter, not Windows .NET Server, because at the time of this writing, Windows .NET Server is still in beta.
Using System Monitor
The units of measurement used to monitor hardware and software resources through System Monitor are called counters , which are then further grouped into categories called objects . In some cases, counters also have instances. For example, when monitoring the processor activity of a Web server, you monitor the % Processor Time counter, which is found under the Processor object. If there is more than one processor in the server, you can choose to monitor the total activity of all of the processors or instances for each individual processor.
A default set of System Monitor objects and counters are made available when you install Windows 2000 Server. If a specific application, such as SQL Server, is installed on the server, SQL Server–specific objects and counters are also made available. In this case System Monitor will use remote procedure calls to collect information from SQL Server.
System Monitor consumes a small amount of CPU and disk resources on the system it is monitoring, which you should keep in mind when measuring and determining the performance of systems and applications. If you are monitoring the machine remotely, System Monitor will also
In addition to monitoring performance counters, System Monitor allows you to
view selected system performance objects and counters in real time.
log performance counter information for later analysis.
monitor multiple Windows 2000 servers from one instance of System Monitor.
create alerts to notify you when certain performance thresholds or conditions occur. For example, when the processor time goes above 90 percent, you can configure the alert to log an entry in the Event Viewer, send a network message, start a performance data log file, run a program when the condition occurs, or all of the above.
trace events to record data when certain activities occur for processes, threads, disk I/O, network I/O, file details and page faults. Trace logs require a parsing tool to interpret the output. You can create such a tool using APIs provided at the following location: http://msdn.microsoft.com/msdn-files. Tracing is rarely used, except by Microsoft support providers.
This chapter looks at the first two
Viewing Real-Time Performance Data
In real-time mode you can view performance data in three different categories: chart, histogram, or report. Viewing data in real time is useful if you know what you are looking for or if you want to verify the existence of a particular bottleneck. When you have to run a stress test overnight for a bottleneck to appear, the best approach is to log the performance data. See the section “Logging and Viewing Logged Data” later in this chapter for more information on this topic.
Chart View
The real-time chart view is an
Figure 4-1. System Monitor graph view
Graph View
Click Start, point to Programs, then Administrative Tools, and then click Performance.
Click System Monitor in the console tree on the left to view System Monitor in the right pane.
To explain the power of chart view for monitoring performance, we’ll walk you through an example of using the graph and histogram views. So, let’s say you want to monitor processor utilization of a multiprocessor system. First, launch System Monitor. The performance console that contains System Monitor opens as shown in Figure 4-2.
TIP
You can also launch System Monitor by typing
perfmon
in the Run command.
Figure 4-2. System Monitor console tree
If the monitor is not in chart view, click the View Chart button at the top of the right pane to switch to chart view.
Counter
Now that you have a graph view containing processor utilization information, let’s explore some of the features of System Monitor you can use to work with the performance data you are collecting. Some of the features are specific to chart view, while others can be used under the report and histogram views as well.
It is important to use the colors to distinguish the data you are monitoring. You can choose each color from a palette (in the Property
BackColorCtl refers to the area
BackColor refers to the chart data-display area.
ForeColor refers to the color of the text in the display and legend.
Counter Scale
Depending on the counter you are monitoring, there will be times when you’ll need to adjust the counter’s scale so the counter information displayed makes more sense. For instance, when monitoring memory-
Counter Characteristics
When you’re selecting counters for data collection, note the counter characteristics. Some counters are formulated as instantaneous and others are averages. Instantaneous counters display the most recent measurements, while averaging counters display the average of the last two measurements over the period between two samples. For the processor object counters on a multiprocessor server, each processor will be listed in the Instances selection box. System Monitor will list the instances from zero. For example, a four-processor server will be listed from instance 0 to 3, where the third instance represents the fourth processor.
It is important that you understand the implications of the counter on the data. For example, if
transaction/sec
is being
Parent Instance Name
If you are monitoring threads of the Microsoft Windows Explorer process, track the Windows Explorer instance of the Thread object (Windows Explorer would be the parent instance), and then each thread running Windows Explorer (these threads are child instances). The instance index allows you to track these child instances. The instance index for the thread you want might be 0, 1, and so on, for each thread, preceded by the number sign (#). The operating system configures System Monitor properties to display duplicate instances by default. Instance index 0 is hidden; numbering of additional instances starts with 1. You cannot monitor multiple instances of the same process unless you display instance indexes.
Computer Name
Each object has counters that are used to measure various aspects of performance, such as transfer rates for disks or the amount of processor time consumed for processors.
Computer Name is the name of the computer that will be displayed at the bottom of the chart view. Be careful when collecting the same objects and counters from different servers; use the colors and different fonts to distinguish between instances on different servers.
Value Bar
The value bar under the chart contains statistical information for the currently selected counters. The value bar can be turned on or off by right-clicking
The values displayed in the value bar are as
The last value displayed for the currently selected counter.
The average value of the currently selected counter.
The minimum value of the currently selected counter.
The maximum value of the currently selected counter.
The total elapsed time displayed in the graph, this value is based on the interval value. The interval value you set determines how often counter data should be collected. For more information on the interval setting see the section “How Often Should You Collect Data?” later in this chapter
Histogram View
The histogram view is the preferred method of viewing data when monitoring multiple instances of the same counter. For example, you can compare the
% Disk Read Time
for all of the
Figure 4-3. Histogram view
Report View
Report view is extremely useful when monitoring counters dealing with logical and physical I/O, such as disk or network I/O. For example, if you have to monitor all the processes running on your Web server concurrently, doing so under chart view would create an extremely hard-to-read graph or histogram. Instead, you can switch to report view for an easy-to-read view of the data.
To view real-time data as a report, you can click the Report tool on the toolbar or type Ctrl+R . Or, you can select Report on the General tab of the System Monitor Properties dialog box.
How Often Should You Collect Data?
For both real-time performance monitoring and data logging, you can set a specific interval for data collection. The interval you set for data collection will have a significant impact on your ability to capture potential performance bottlenecks. For the most part, the type of bottleneck you are investigating will determine the interval period you set. For instance, if you are monitoring a problem that
Also consider the overall length of time you want to monitor when choosing this interval. Updating every 15 seconds is reasonable if you will be monitoring for no more than four hours. If you’ll be monitoring a system for eight hours or more, do not set an interval shorter than 300 seconds (five minutes). Setting the update interval to a frequent rate (that is, a low value) can cause the system to generate a large amount of data, which can be difficult to work with especially if you’re
Monitoring many objects and counters can also generate a large amount of data and consume disk space. Try to strike a balance between the number of objects you monitor and the sampling frequency to keep log file
If you prefer to maintain a long update interval when logging, you can still view data fluctuations that occur between those intervals. To do so, see the
Logging and Viewing Logged Data
One of the most
You can capture System Monitor data for a specific period of time and then analyze and compare the performance log files later on. This will allow you to view the system behavior over time, which can reveal trends in system usage that you might not see when viewing real-time data. For example, in your log files you might find that disk utilization is typically high from 8 P.M to 10 P.M and lower for the remainder of time. You might be able to equate this trend to heavy data entry or a database backup during these times.
NOTE
When you use System Monitor, it is most efficient to start the log locally on the server you want to collect data from. You can access the log file later from a remote system if you need to. If you must log over the network, reduce the number of objects and counters to the most critical ones.
To start logging information on a Windows 2000 server using System Monitor, follow these steps:
Click Start, Programs, then point to Administrative Tools, and click Performance.
Expand Performance Logs And Alerts in the left pane of the performance window.
Select Counter Logs in the console tree.
In the right pane, right-click and choose New Log Settings from the shortcut menu as shown in Figure 4-4.
Figure 4-4. Create log
Enter a name to identify the log settings in the New Log Settings dialog box as shown in Figure 4-5, and then click OK. We chose IBuyspy for the name of this log setting.
Figure 4-5. New Log Settings
The name you choose for the log setting will appear as the title for the Performance Log dialog box. Click the Add button to
Add the counters that you want saved to the log file by highlighting them and then clicking the Add button. When finished adding counters, click Close in the Select Counters dialog box. On the General tab of the Performance Log dialog box, you can also set the interval for sampling data.
Click the Log Files tab to set log file–specific information, such as location, file name, file type, and maximum file size limit. Use CSV files for the default file type, especially if you are collecting data for a long period of time, in order to maintain manageability. As shown in Figure 4-6, in this example we save the file locally.
NOTE
It is always a good idea to select a high interval for the sampling data value when collecting performance data over a long period of time. This is most important to note when saving data as a binary file—binary files are always larger than CSV files.
Figure 4-6. Log file information
Click the Schedule tab to set the schedule for logging. If you do not enter a time for the logging to stop, it will continue until you stop it manually.
Click OK. The log file name should appear in the right pane. The green icon next to the log name shows logging has started, as shown in Figure 4-7.
Figure 4-7. Log file started
The icon will be red if the logging is
After you have collected information and stopped the logging process, use the following steps to load logged data into the system and view it.
Click System Monitor in the left pane to view System Monitor in the right pane.
Click the View Log File Data button at the top of the right pane to open the Select Log File dialog box, as shown in Figure 4-8. Navigate to the folder and select the log file you want to view and then click open.
Figure 4-8. Log File dialog box
Click the Add button to add the counters you want to view from the selected log file. When you close the Add Counters dialog box you will see the selected counters in System Monitor, as shown in Figure 4-9. Only the counters selected for initial logging will be available for viewing.
Figure 4-9. Add Counters
You can narrow your view of the log file by following these additional steps:
After you have loaded your log file into System Monitor, click the Properties button at the top of the right pane.
In the System Monitor Properties dialog box, click the Source tab.
Near the bottom of the Source tab, slide both ends of the slide window to include the times that you want to see in the View range as shown in Figure 4-10.
Figure 4-10. Log file information
(Optional) Use the other tabs in System Monitor Properties dialog box to change the different characteristics of the output.
Click OK to return to System Monitor and view the selected range of the data.
Monitoring Remote Computers
With System Monitor you can remotely collect and monitor data from multiple machines. There could be several reasons why you would want to monitor remote machines—for example, the server in question could be located in a lab or production environment across the country.
Before you start monitoring remote computer performance you must have Access This Computer from the Network rights. These rights are granted by following these steps:
From the Administrative Tools folder, launch the Local Security Policy program.
Double-click the Local Policies folder to expand it.
Double-click the User Rights Assignment folder. The currently defined list of policy rights will be displayed.
Find the policy Access This Computer from the Network and double-click to open it. A list of users and groups assigned to the policy will be displayed.
To assign additional users or groups to the policy click the Add User or
To monitor a remote computer follow these steps:
Start System Monitor and then press Ctrl+I to open the Add Counters dialog box.
In the Select Counters From Computer list, select or type the name of computer you want to monitor.
You should keep your connection speed in mind when monitoring computers remotely. If you have a slow connection speed (128 Kbps or slower) you may want to switch from the default chart view to report view. This way you’ll be passing far fewer graphics over the wire, and avoiding delays in results being displayed on your screen.