Counter of Festivals

Ashok Blog for SQL Learners and Beginners and Experts

Tuesday, 12 May 2015

Perfmon Tool in SQL Server to monitor performance of Server

Database Performance Counters

Most DBAs and developers probably use Profiler, trace, review query plans, run sp_who2, run DBCCs, etc... to capture data to figure out what is currently running on the database server.  These tools are great, but don't give you the entire picture in an easy to use way.
Another tool that all DBAs and developers should use is Performance Monitor.  This OS level tool provides great insight into Windows counters, but also into specific SQL Server counters.  There are hundreds of counters that are exposed within this tool and there are several that are specific to SQL Server. 
To launch Performance Monitor, click Start, Run... and type in "perfmon" and the following should open.  This application can also be found under the Administrative Tools.
To add a counter, click on the + icon or use Ctrl + I and the following will open.
Most of the counters are server specific and do not give you insight into each individual database, but the following list of counters are at the database level, so this means you can collect this data for each database that is on the server as well as an overall count for all databases.
If you navigate to the "Databases" performance objects you can see the counters that are specific to SQL Server databases which are also listed below.
CounterDescription
Active TransactionsNumber of active update transactions for the database.
Backup/Restore Throughput per/secRead/write throughput for backup/restore of a database.
Bulk Copy Rows/secNumber of rows bulk copied.
Bulk Copy Throughput/secKiloBytes bulk copied.
Data File(s) Size (KB)The cumulative size of all the data files in the database.
DBCC Logical Scan Bytes/secLogical read scan rate for DBCC commands
Log Bytes Flushed/secTotal number of log bytes flushed.
Log Cache Hit RatioPercentage of log cache reads that were satisfied from the log cache.
Log Cache Reads/secReads performed through the log manager cache.
Log File(s) Size (KB)The cumulative size of all the log files in the database.
Log File(s) Used Size (KB)The cumulative used size of all the log files in the database.
Log Flush Wait TimeTotal wait time (milliseconds).
Log Flush Waits/secNumber of commits waiting on log flush.
Log Flushes/secNumber of log flushes.
Log GrowthsTotal number of log growths for this database.
Log ShrinksTotal number of log shrinks for this database.
Log TruncationsTotal number of log truncations for this database.
Percent Log UsedThe percent of space in the log that is in use.
Repl Pending XactsNumber of pending replication transactions in the database.
Repl Trans RateReplication transaction rate (replicated transactions/sec.).
Shrink Data Movement Bytes/secThe rate data is being moved by Autoshrink, DBCC SHRINKDATABASE or SHRINKFILE.
Transactions/secNumber of transactions started for the database.
Why is this helpfulDepending on your database server, most SQL Servers host multiple databases and applications.  Some of these databases are quite busy and others are not used at all.  When deciding to consolidate servers, move databases to another server or moving databases to different physical disks these counters can show you where the bottlenecks may be and also which databases are more busy than others.
Some of the useful database counters to collect are:
  • Transactions/sec
  • Log Cache Hit Ratio
  • Log Cache Reads/sec
  • Log Bytes Flushed/sec
  • Log Flush Wait Time
  • Log Flush Waits/sec
  • Log Flushes/sec
  • Percent Log Used
By collecting this data for all of your databases you can see where the most activity is occurring.  Also, by using Performance Monitor you can easily graph out and trend these various counters for each of your databases.  Whether you get this information from running DBCC commands, using the DMVs in SQL 2005 or by using Performance Monitor it doesn't really matter, but these are things that should be reviewed and trended to ensure your databases are running as optimally as possible.