Getting Started with PerfMon
PerfMon is a component of Reliability
and Performance Monitor which can be launched from Start ⇒ All Programs
⇒ Administrative Tools. Alternatively, just type perfmon into the Run box and press Enter.
As mentioned earlier, PerfMon is a Windows
monitoring tool, and as such it can be used to monitor any application
— from Microsoft Exchange to Windows itself. When an application is
installed, performance counters are registered and you can monitor the
counters in real time or trace them to a log file. PerfMon isn’t
designed specifically for SQL Server, so you need to add the relevant
Windows and SQL Server counters to a log file in order to view resource
utilization and SQL Server activity.
Monitoring Real-Time Server Activity
One of the most common uses for PerfMon
is viewing real-time server activity. PerfMon provides data instantly
on system workload, performance, and resource consumption. By reading
the data presented by PerfMon, you can rapidly narrow the scope of a
problem.
Within Reliability and Performance Monitor,
select Performance Monitor from the Monitoring Tools folder. You’ll be
presented with a line chart plotting percentage of processor time from
your own computer, as shown in Figure 2. In this section, you’ll add a few counters to get a feel for CPU, disk, and memory activity on your PC.
Right-click anywhere in the chart area and choose
Add Counters. From here you can choose from hundreds of counters to
monitor! Scroll through the list of counters until you see Memory and
expand the Memory counter. Select Available Mbytes and click Add. Next,
scroll to locate the LogicalDisk counter and select Avg. Disk
sec/Transfer. If you have multiple disks, select each disk individually
from the instance list and click OK as shown in Figure 3.
The counters will be added to the performance
graph immediately and as the red timeline moves across the screen, each
counter will be populated with data.
Note a couple of pointers: Organize the columns
so you can read each row more easily; press Ctrl+H to enable
highlighting for a selected counter — this means the line graph is
highlighted. Select all counters, right-click, and choose Scale
Selected Counters to ensure they are all displayed within the screen.
Mostly you’ll want to monitor a server (rather
than your own workstation), and it’s possible to use PerfMon to monitor
a remote server by typing the server name from the Add Counters dialog.
If you’re adding a lot of counters, the graph can become a little
unwieldy because individual counters become difficult to read. If so,
you have three options: Remove nonrequired counters, hide nonrequired
counters (uncheck Show button), or use a report view instead of the
line graph (select Report from the mini drop-down on the top menu bar).
Starting Out with Data Collector Sets
Data Collector Sets are groups of
data-gathering tools. They can include kernel tracing, performance
logs, and configuration data. Three Data Collector Sets are provided
out-of-the-box, including a system performance collector that consists
of a kernel trace and a PerfMon log. To utilize a pre-defined data
collector, select Data Collector Sets ⇒ System, right-click System
Performance, and select Start.
The system performance collector runs for 60
seconds. When collection has finished, navigate to Reports ⇒ System ⇒
System Performance, and choose the latest report. As shown in Figure 4, the report presents data in a very readable layout.
The System Performance report begins with a summary of the four key resources: CPU, Disk, Memory, and Network. Figure 4
shows memory utilization at 94% and the diagnostic results indicate
excessive paging and low memory, recommending either adding more memory
or reducing system load. The Resource Overview section shows memory
status with a red traffic signal, highlighting a memory issue.
The small effort required to start the system
performance collector, wait 60 seconds, and launch the report results
in a conclusive initial investigation. In this case, the top process
shown in the memory summary is SSMS (SQL Server Management Studio), and
the next step would be to identify the problem session and resolve the
issue.