Lesson 2 Using the Performance Console 19-13 Lesson 2: Using the Performance Console Windows XP Professional provides two tools for monitoring resource usage: the System Monitor snap-in and the Performance Logs And Alerts snap-in. Both of these snap-ins are contained in the Performance console. You use the System Monitor snapin to track resource use and network throughput. You use the Performance Logs And Alerts snap-in to collect performance data over time from the local or a remote computer or to have Windows XP alert you when a particular performance threshold is crossed. After this lesson, you will be able to ■ Use System Monitor to monitor resource usage ■ Add counters to System Monitor ■ Use Performance Logs And Alerts to track a computer’s performance ■ Establish a baseline for performance data ■ Identify and resolve bottlenecks Estimated lesson time: 30 minutes How to Use System Monitor To access the Performance console, click Start, click Control Panel, click Performance And Maintenance, click Administrative Tools, and then double-click the Performance shortcut. The Performance console contains the System Monitor snap-in and the Performance Logs And Alerts snap-in (see Figure 19-5). F19us05 Figure 19-5 The System Monitor snap-in displays counter values in a graph by default. 19-14 Chapter 19 Monitoring and Optimizing System Performance You use System Monitor to collect and view real-time data about memory, disk, processor, network, and other activity on your computer or on remote computers. You can view this data in a graph, a histogram, or a report. To change the display, you can click the appropriate icon, as shown in Figure 19-5, or use the following key combinations: Ctrl+G for the graph, Ctrl+B for the histogram, and Ctrl+R for the report. Note A histogram is a chart that consists of horizontal or vertical bars. The widths or heights of these bars represent the values of certain data. Monitoring resources on your computer and overall system performance can help you to do the following: ■ Evaluate how well your computer is currently performing ■ Detect and eliminate bottlenecks to improve performance ■ Look for trends to plan for future growth and upgrades ■ Evaluate the effects of tuning and configuration changes on your computer The Performance tool classifies information in the following areas: Object An object represents a major system component (hardware or software) of the computer or operating system. Examples of objects include physical disks, processor, and memory. Instance Each occurrence of an object is considered an instance. For example, if there are two processors on a computer, there are two processor instances. If there are three hard disks on a computer, each disk is represented by a separate instance. Not all objects have multiple instances. If there is only one instance, the Performance snap-in shows a dash for the Instance value. Counter A counter is a particular aspect of an object that System Monitor can measure. For example, the physical disk object contains the following counters: ❑ Percentage Disk Read Time ❑ Average Disk Bytes Per Read ❑ Disk Reads Per Second System Monitor helps you gauge a computer’s efficiency and locate and resolve current or potential problems. You monitor resources on your computer by selecting objects in System Monitor. A set of counters exists for each object; Table 19-3 describes some of the available objects. Lesson 2 Table 19-3 Using the Performance Console 19-15 Partial List of Available Objects in System Monitor Object Description Cache Used to monitor the file system cache used to buffer physical device data Memory Used to monitor the physical and virtual memory on the computer PhysicalDisk Used to monitor a hard disk as a whole Processor Used to monitor CPUs When you first start the Performance tool, the graph displays three counters by default: Pages/sec Represents the rate at which pages are read from or written to disk during virtual memory operations. Consistently high values can indicate that not enough memory is present on a computer. Avg. Disk Queue Length Represents the average number of read and write requests queued for the selected disk. Consistent values above 0 means that requests are backing up, which might indicate not enough memory or a slow disk system. %Processor Time Represents the percentage of elapsed time that the processor spends executing nonidle tasks. Consistently high values (exceeding approximately 80 percent) might indicate that the processor is slowing down your computer. How to Add Counters Adding counters to an object (such as those described in Table 19-3) allows you to track certain aspects of the object. The three default counters loaded with System Monitor actually do a very good job of representing the basic aspects of a computer’s performance. Of course, they are only three of the hundreds of counters that are available. The counters that you monitor depend on whether you are trying to collect general baseline information, troubleshoot a performance problem, diagnose an issue with an application, and so on. The following steps allow you to add counters to an object in System Monitor: 1. At the bottom of the Performance console, right-click Counter and click Add Counters. The Add Counters dialog box appears. 2. In the Performance Object list box, select the object for which you want to add counters. 3. Ensure that Select Counters From List is selected. You can add all counters, but that usually provides more information than you need or can interpret. 4. Select a counter from the list, and click Add. 19-16 Chapter 19 Monitoring and Optimizing System Performance For an explanation of a counter, select it and then click Explain. Tip If you want to add several counters at the same time, you can hold down Ctrl to select individual counters from the list. You can hold down Shift if you want to select several counters in a row, and click the first in the list you want and then click the last in the list that you want to select. All counters listed between the first and last you clicked are automatically selected. 5. When you have completed your selection of objects and counters, click Close to return to the Performance console. Table 19-4 explains a few of the counters that you might find useful for evaluating your computer’s performance. Table 19-4 Partial List of Counters That Are Available in System Monitor Counter Description Under Processor, choose %Processor Time Indicates the percentage of time that the processor spends executing a nonidle thread, which is the percentage of time that the processor is active. During some operations this might reach 100 percent. Periods of 100 percent activity should occur only occasionally. This counter is the primary indicator of processor activity. Sustained values over 80 percent indicate a potential processor bottleneck. Under Processor, choose %Interrupt Time Indicates the time that the processor spends receiving and servicing hardware interrupts during sample intervals. This value is an indicator of the activity of devices that generate interrupts (such as the system clock, mouse, and disk drivers). Devices like these typically interrupt the processor when they complete a task or require the processor’s attention. If the %Processor Time value is greater than 90 percent, and the %Interrupt Time value is greater than 15 percent, this processor is probably in need of assistance to handle the interrupt load. Under Processor, choose % DPC Time Indicates how much time the processor is spending processing DPCs. DPCs are software interrupts or tasks that require immediate processing, causing other tasks to be handled at a lower priority. DPCs represent further processing of client requests. Under System, choose Processor Queue Length Indicates the number of threads in the processor queue. There is a single queue for processor time, even on computers with multiple processors. A sustained processor queue of greater than two threads usually indicates that the processor is slowing down the overall system performance. Lesson 2 Table 19-4 ! Using the Performance Console 19-17 Partial List of Counters That Are Available in System Monitor Counter Description Under Memory, choose Pages/sec Indicates the number of pages that were either read from disk or written to disk to make room in physical memory for other pages. This counter is the primary indicator of whether the computer has sufficient memory. An average value in excess of 20 can indicate insufficient memory in the computer. Under Memory, choose Available Bytes Indicates the amount of physical memory that is unallocated in the computer. Does not include any memory that is allocated to working sets or file system cache. Under Paging File, choose %Usage Indicates the percentage of the paging file that is currently in use. Under Paging File, choose %Usage Peak Indicates the peak percentage of the paging file in use. Under Cache, choose Copy Read Hits % Indicates the percentage of time that information was found in the file system cache and did not have to be read from disk during a file read operation (typically used by file systems and during small network transfers). A low value (lower than 70 percent) indicates that Windows might not have enough physical memory to keep up with the demands. Under Logical Disk, choose %Free Space Indicates the ratio of free disk space that is available to total usable disk space on a particular logical disk. Under Physical Disk, choose %Disk Time Indicates the percentage of time that the selected physical disk is busy servicing read or write requests. If this value is consistently over 50 percent, the hard disk is having trouble keeping up with the load that is being placed on it. Under Physical Disk, choose Avg. Disk Queue Length Indicates the average number of both read and write requests that are queued for the selected disk. If this value averages 2 or more, the disk is a bottleneck. Exam Tip Memorize the counters mentioned in this chapter, and understand the values of each counter that indicate a potential problem. In particular, you should remember the three default counters used in System Monitor: Pages/sec, Avg. Disk Queue Length, and %Processor Time. How to Use Performance Logs And Alerts Performance Logs And Alerts allows you to log counter information to a file and to trigger alerts that are based on configured events. You can automatically collect performance data from the local computer or from remote computers. You can view the 19-18 Chapter 19 Monitoring and Optimizing System Performance logged data from System Monitor, or you can export it to a spreadsheet program or a database, such as Structured Query Language (SQL). The Performance Logs And Alerts node in the Performance console (see Figure 19-6) contains three subsections: Counter Logs Trace Logs Log activity for selected counters at regular intervals Log activity for selected counters when a particular event occurs Alerts Log activity and can notify a user when a particular counter exceeds a certain threshold F19us06 Figure 19-6 Use the Performance Logs And Alerts snap-in to track performance over time or alert you to performance problems. How to Enable Performance Logging To enable performance logging, use these steps: 1. In the Performance window, expand Performance Logs And Alerts. 2. Right-click Counter Logs, and select New Log Settings. 3. In the New Log Setting dialog box, enter the name for the log and click OK. 4. On the General tab, add the counters that you want to log. Modify the sampling interval if necessary. 5. On the Log Files tab, you can modify the name and location of the log file, as well as the type of file if desired. 6. On the Schedule tab, configure the start and stop times for logging. You can manually stop and start logging, or you can configure logging to start and stop at specified times. 7. Click OK to save the log configuration. Lesson 2 Using the Performance Console 19-19 Real World Capture Performance Data from a Remote Computer To get a real picture of the performance of a computer, it is best if you use a different computer to monitor performance than the computer that is being monitored. The reason for this is that the Performance console itself uses some system resources. To use System Monitor or Performance Logs And Alerts to monitor a remote computer, all you have to do is select the remote computer when you add counters. In the Add Counters dialog box, click Select Counters From Computer, and then select the computer from the drop-down list (or type the UNC path for the computer). How to View Performance Data from a Log After you create a log, you can load the log into the Performance console and view it the same way that you would view real-time performance data. To view a performance log, follow these steps: 1. In the Performance console, click System Monitor, right-click the data display, and then select Properties. 2. In the System Monitor Properties dialog box, on the Source tab, select Log Files. Click Add, and enter the name of the log file that you want to view. Click OK to continue. 3. Right-click the data display, and then select Add Counters. 4. Add the counters that you want to view, and then click OK. The available counters are limited to those that are present in the log. How to Configure an Alert In addition to using other monitoring techniques, you can use alerts to notify users or administrators when conditions exceed preset criteria. For example, you can configure an alert to send a message to the administrator when processor utilization exceeds 80 percent. When an alert is triggered, you can perform the following actions: ■ Log an entry in the application event log. This option is enabled by default. ■ Send a network message to a particular user. ■ Start a performance log that can further monitor the alert condition. ■ Run a program that can be used to launch any application program. You can use this option to launch a script that would send e-mail to the administrator. 19-20 Chapter 19 Monitoring and Optimizing System Performance To configure an alert, follow these steps: 1. In the Performance console, expand Performance Logs And Alerts. 2. Right-click the Alerts folder, and select New Alert Settings. 3. Enter a name for the alert, and click OK. 4. On the General tab, add the counter or counters and the alert value. 5. On the Action tab, configure the action or actions to be performed when an alert is triggered. 6. On the Schedule tab, configure the start and stop times for when the alert should be scanned. You can turn scanning on and off manually or configure scanning to occur on a schedule. 7. Click OK to create the alert. How to Establish a Baseline for Performance Data When you are ready to begin monitoring the resources on your computer, the first thing you need to do is establish a baseline. A baseline is a measurement derived from collecting data over an extended period of time. The data should reflect typical types of workloads and user connections but should also include any unusual activity that might occur. The baseline represents resource usage under normal conditions. After you collect data on performance over an extended period of time, with data reflecting periods of low, average, and high usage, you can determine what is acceptable performance for your computer, and that determination becomes your baseline. You use the baseline to determine when bottlenecks are developing or to watch for changes in usage patterns. Determining bottlenecks will help you in troubleshooting problems that might arise. Watching for changes in usage patterns will help you plan for the future. On the CD At this point, you should watch the multimedia presentation “Creating a Performance Baseline” included in the Multimedia folder on the CD accompanying this book. How to Identify and Resolve Bottlenecks Deviations from your baseline are good indicators of performance problems. A bottleneck exists if a particular component’s limitation is slowing the entire system performance. Even if one component in your computer is heavily used, if the other components or the system as a whole are not slowed down, there is no bottleneck. Lesson 2 Using the Performance Console 19-21 If you discover a bottleneck on your computer, here are some basic suggestions to help you solve the problem: ■ If paging values are high (meaning that Windows is transferring pages of information from physical memory to disk more than you would expect), identify processes that are using the most memory. To do this, use the Processes tab of Task Manager and sort by the Mem Usage column. Stop any unnecessary applications or processes, and consider disabling the underlying service. For example, if a program running in the background uses a lot of memory and it is a program you do not really need, disable the program from starting with Windows. ■ If you see high processor utilization, see if you can determine which applications are consuming the most processor time. To do this, use the Processes tab of Task Manager and sort by the CPU column. If you do not need an application that is consuming processor time, close the application. If an application seems to be consuming too much processor time for a long period (in other words, not just when the program is starting up or performing an intensive process), there might be a problem with the application. Stop the application and start it again, or restart the computer and then restart the application. If the application continues to consume excessive amounts of processor time, there might be a problem with the application. ■ If you continue to see high processor utilization, and the programs consuming the most processor time are programs you use regularly, you should consider upgrading to a faster processor. ■ If you have programs consuming processor time that are multithreaded programs, consider installing a second processor. You can often gain more effective speed with a dual processor configuration than with a faster single processor. ■ If you see high processor utilization, but do not discover that programs are consuming too much processor time, you should use System Monitor to check the % Interrupts value. It is possible that a malfunctioning piece of hardware is trying too often to interrupt the processor. ■ If you see a high disk queue value, but do not see high paging file use, the bottleneck is more likely a slow hard disk than low memory. Consider adding a faster disk. ■ Never make more than one change at a time when trying to resolve a bottleneck, and always repeat monitoring to verify that the change you made actually improved the situation. 19-22 Chapter 19 Monitoring and Optimizing System Performance Practice: Using System Monitor In this practice, you use System Monitor to monitor system resources. You add objects and counters to control what is being monitored, and you then view the three views— graph, histogram, and report—for output. 1. Click Start, click Control Panel, and then click Performance And Maintenance. 2. Click Administrative Tools, and then double-click the Performance shortcut. Windows XP Professional starts the Performance console with the System Monitor selected. 3. What objects and counters are monitored by default? 4. Under the graph, right-click Counter, and then click Add Counters. Windows XP Professional displays the Add Counters dialog box. 5. Which performance object and counter are selected by default? 6. In the Select Counters From list, select Interrupts/Sec, and then click Explain. Windows XP Professional displays an Explain Text dialog box indicating that Interrupts/Sec is the average number of hardware interrupts that the processor receives and services each second. 7. Close the Explain Text window. 8. Click Add to add the Interrupts/Sec counter to the Processor object. 9. In the Performance Object list box, select Paging File. 10. Under Select Counters From List, ensure that %Usage is selected, and then click Add to add the Paging File object with the %Usage counter. 11. Close the Add Counters dialog box. 12. Press Ctrl+B to view a histogram. 13. Press Ctrl+R to view a report. 14. Press Ctrl+G to return to a graph. 15. Close the Performance console. Lesson 2 Using the Performance Console 19-23 Lesson Review Use the following questions to help determine whether you have learned enough to move on to the next lesson. If you have difficulty answering these questions, review the material in this lesson before beginning the next lesson. You can find answers to these questions in the “Questions and Answers” section at the end of this chapter. 1. Which of the following monitoring tools are included in the Performance console? (Choose all answers that are correct.) a. System Monitor snap-in b. Task Manager snap-in c. Performance Logs And Alerts snap-in d. Task Scheduler 2. Why should you monitor resources and overall system performance? 3. What is a baseline, and what is a bottleneck? 4. Why do you need to determine a baseline when you monitor system resources and system performance? Lesson Summary ■ The Performance console contains the System Monitor snap-in and the Performance Logs And Alerts snap-in. The System Monitor snap-in allows you to monitor the performance of your computer or other computers on the network. 19-24 Chapter 19 Monitoring and Optimizing System Performance ■ The System Monitor snap-in provides performance objects that consist of counters for collecting data. You can add any of hundreds of counters, each of which measures a particular aspect of system performance. ■ The Performance Logs And Alerts snap-in records performance data and system alerts on your local computer or from remote computers. ■ A baseline is a measurement derived from collecting data over an extended period of time that represents resource usage under normal conditions. ■ A bottleneck is any component that slows down the entire system’s performance. Case Scenario Exercise In this exercise, you will read a scenario about using System Monitor to measure system performance, and then answer the question that follows. If you have difficulty completing this work, review the material in this chapter before beginning the next chapter. You can find answers to these questions in the “Questions and Answers” section at the end of this chapter. Scenario You are an administrator working for a company named Fabrikam, Inc., a regional public relations firm with its headquarters in Dallas, Texas, and several branch locations throughout the country. You are working with Pat, a user in the company’s accounting department (which is located in the main office). Pat recently noticed that her computer’s performance has decreased, and it is functioning at unacceptably slow levels when running resource-intensive applications. The computer is configured as follows: ■ Processor: Pentium 4 2.8 GHz ■ RAM: 256 MB ■ Hard disk: 12 GB Questions 1. You want to monitor memory, processor, and disk usage over the course of a normal day’s activity on Pat’s computer. Which tool should you use to do this? Troubleshooting Lab 19-25 2. What objects and counters would you select? 3. At the end of the day, you use System Monitor to view the log created on Pat’s computer. You note the following key average counter values: ❑ Memory, Pages/sec: 92 ❑ Processor, %Processor Time: 35 percent ❑ Physical Disk, %Disk Time: 73 percent What do you suspect is causing the performance problem? How would you resolve it? Troubleshooting Lab In this lab, you will create a performance log on your own computer and then read the results. To create a performance log, use the following steps: 1. Click Start, and then click Control Panel. 2. In the Control Panel window, click Performance And Maintenance. 3. In the Performance And Maintenance window, click Administrative Tools. 19-26 Chapter 19 Monitoring and Optimizing System Performance 4. In the Administrative Tools window, double-click Performance. 5. In the Performance window, expand Performance Logs And Alerts. 6. Right-click Counter Logs, and select New Log Settings. 7. In the New Log Setting dialog box, type My Performance for the name for the log and click OK. 8. In the My Performance dialog box, on the General tab, use the Add Counters button to add the following counters: ❑ Memory: Pages/sec ❑ Paging File (_Total): %Usage ❑ Processor: %Processor Time ❑ System: Processor Queue Length ❑ Physical Disk: Disk Reads/sec ❑ Physical Disk: Disk Writes/sec ❑ Physical Disk: Avg. Disk Queue Length 9. On the Schedule tab, configure the start time for five minutes in the future. In the Stop Log section, click After, and then set the stop time for one hour from now. 10. Click OK to save the log configuration. Windows displays a dialog box asking whether you want to create the new log file. 11. Click Yes. 12. In the Performance window, under Performance Logs And Alerts, click Counter Logs. 13. In the right-hand pane, what do you notice about the My Performance log? 14. While the log is recording, you should continue to use your computer as you normally would. Be sure to run multiple applications (you can even play pinball—a fairly resource-hungry program). 15. After one hour has elapsed, return to the Performance window. The My Performance log icon should now be red, indicating that the log is stopped. Lesson 2 Using the Performance Console 19-27 16. Click System Monitor. 17. Press CTRL+L (or click the View Log Data button) to open the System Monitor Properties dialog box with the Source tab showing. 18. Click Log Files. 19. Click Add. 20. Locate the My Performance log file. The default location for log files is C:\PerfLogs. Click OK. 21. In the Performance window, add each of the counters that you configured the log to monitor. 22. Click the View Report button (or press CTRL+R). 23. Record the values for each counter in the following table. Object: Counter Value Memory: Pages/sec Paging File (_Total): %Usage Processor: %Processor Time System: Processor Queue Length Physical Disk: Disk Reads/sec Physical Disk: Disk Writes/sec Physical Disk: Avg. Disk Queue Length 24. Do you notice any values that indicate a bottleneck? If so, list the values and explain what you would do to troubleshoot the problem. 25. Close the Performance window.