5
04.01.2011 Page 1 of 5 SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008 I/O performance Note Language: English Version: 4 Validity: Valid Since 21.05.2010 Summary Symptom This note is relevant for SQL Server 2005 and subsequent releases. For older releases please refer to note 521750. 1. Which counters on I/O performance does SQL Server provide? 2. Where do I find I/O counters in the SAP database monitor? 3. What are the reference values for the 'IO per File' counters? 4. What are the reference values for the 'dbcc sqlperf(WAITSTATS)' counters? 5. How can I monitor the impact of I/O on the current database activity? 6. What else can I use to monitor SQL Server I/O? 7. What can I do when I have identified an I/O bottleneck? Other terms IO per File, sys.dm_io_virtual_file_stats, dbcc sqlperf(waitstats) Reason and Prerequisites This note describes how you can monitor I/O performance for a SAP system on SQL Server 2005. The description of the SAP database monitor for SQL Server (transactions ST04 or DBAcockpit) requires SAP basis release 6.40 or later. For older SAP releases note 521750 provides a hint what information is included in the SAP database monitor. Using the remote monitoring capabilities of the SAP Solution Manager 4.0 this note also applies for monitoring any other SQL Server 2005 database. Solution 1. Which counters on I/O performance does SQL Server provide? SQL Server measures I/O activity and performance for each database file. These counters are available through the sys.dm_io_virtual_file_stats dynamic management view well documented in Books Online. In this note and in the SAP database monitor values based on this view are referred to as "IO per file". This view provides the number of reads and writes together with the time spent waiting on read I/O in ms ( io_stall_read_ms ) and the time spent waiting on write I/O in ms ( io_stall_write_ms). (The sum of both is in io_stall.) The number of bytes read and written can be found also. All values are per file and refer to time since SQL Server start, which is provided in milliseconds as sample_ms. All versions of SQL Server provide the command dbcc sqlperf(WAITSTATS). Some of the wait events are related to I/O performance. These are in particular - PAGEIOLATCH_SH: indicates I/O performance on data files; this is one server wide value since SQL Server start (or last

Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

Embed Size (px)

Citation preview

Page 1: Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

04.01.2011 Page 1 of 5

SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008I/O performance

Note Language: English Version: 4 Validity: Valid Since 21.05.2010

Summary

SymptomThis note is relevant for SQL Server 2005 and subsequent releases. Forolder releases please refer to note 521750.

1. Which counters on I/O performance does SQL Server provide?

2. Where do I find I/O counters in the SAP database monitor?

3. What are the reference values for the 'IO per File' counters?

4. What are the reference values for the 'dbcc sqlperf(WAITSTATS)'counters?

5. How can I monitor the impact of I/O on the current database activity?

6. What else can I use to monitor SQL Server I/O?

7. What can I do when I have identified an I/O bottleneck?

Other termsIO per File, sys.dm_io_virtual_file_stats, dbcc sqlperf(waitstats)

Reason and PrerequisitesThis note describes how you can monitor I/O performance for a SAP system onSQL Server 2005. The description of the SAP database monitor for SQL Server(transactions ST04 or DBAcockpit) requires SAP basis release 6.40 or later.For older SAP releases note 521750 provides a hint what information isincluded in the SAP database monitor.Using the remote monitoring capabilities of the SAP Solution Manager 4.0this note also applies for monitoring any other SQL Server 2005 database.

Solution

1. Which counters on I/O performance does SQL Server provide?SQL Server measures I/O activity and performance for each databasefile. These counters are available through the sys.dm_io_virtual_file_stats dynamic management view well documentedin Books Online. In this note and in the SAP database monitor valuesbased on this view are referred to as "IO per file". This viewprovides the number of reads and writes together with the time spentwaiting on read I/O in ms ( io_stall_read_ms ) and the time spentwaiting on write I/O in ms ( io_stall_write_ms). (The sum of both isin io_stall.) The number of bytes read and written can be found also.All values are per file and refer to time since SQL Server start,which is provided in milliseconds as sample_ms.All versions of SQL Server provide the command dbcc sqlperf(WAITSTATS).Some of the wait events are related to I/O performance. These are inparticular

- PAGEIOLATCH_SH: indicates I/O performance on data files; thisis one server wide value since SQL Server start (or last

Page 2: Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

04.01.2011 Page 2 of 5

SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008I/O performance

counter reset).

- WRITELOG: indicates I/O performance on transaction log file(s);this is one server wide value since SQL Server start (or lastcounter reset).

2. Where do I find I/O counters in the SAP database monitor?The CCMS monitor (transaction RZ20) includes the I/O counters.In the entry screen of the SAP database monitor change from the'Overview' to the 'Current activity' tab. The counters

Latch Wait Time per Request (ms) Wait Time per Log Write (ms) IOStall per Request (ms)

are based on PAGEIOLATCH_SH, WRITELOG, and the reads of 'IO per File'.These data are for the last 20 minutes.From the entry screen of the SAP database monitor drill down choosing'DB Collector'. On the 'Snapshot' tab the 'I/O' tab allows to analyzethe performance of the last 20 minutes on three different levels ofaggregation: SQL Server wide, per database, or per file. Only the'IOStall per Request' are shown.On the 'Snapshot Details' tab when chosing on of the 'VirtualFilestats' categories also the activity in terms of reads, writes, andbytes is shown.Using the 'Time Series' tab the history of I/O performance can beanalyzed and displayed as chart.Alternatively from the entry screen of the SAP database monitor drilldown choosing 'Detail Analysis menu'.

- 'IO per File' shows the data for the <SID> and the tempdbdatabases, both from SQL Server start and for the last 20minutes (colums denoted 'recently').

- 'DB utilities' -> 'dbcc sqlperf(waitstats) Wait statistics'displays the wait events of SQL Server since its start. The'Time/Request' column shows already the calculated KPI value.

- 'System tables': Raw data are displayed at 'DBCC commands' ->'DBCC sqlperf(waitstats)' and at 'System functions' ->'::fn_virtualfilestats(-1,-1) system function'.

3. What are the reference values for the 'IO per File' counters?No generally applicable reference values can be specified for the 'IOper File' counters on SQL Server 2005. Compared to SQL Server 2000 notonly additional data is available (io_stall values for read an writeseparately) but data are also measured differently. The values in SQLServer 2005 are now closer to the times observed in the Windows SystemMonitor. On some SAP systems times as high as 400 ms/read have beenobserved without indication of database performance issues.Nevertheless these counters are very valuable for analyzing I/Operformance of SQL Server 2005. But they need to be evaluated takinginto account the specific I/O load profile in terms of number and sizeof I/O operations.It is reasonable to expect values less then 10 ms/read on data filesand less then 5 ms/write on transaction log files. As stated abovevalues much higher then this do not allow to deduce an I/O bottleneck.

Page 3: Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

04.01.2011 Page 3 of 5

SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008I/O performance

4. What are the reference values for the 'dbcc sqlperf(WAITSTATS)'counters?From the output of sqlperf(WAITSTATS) you have to divide WAITTIME byREQUESTS. For these quotients (which are already included in the SAPdatabase monitor as 'Time/Request') the following reference valueshold for the average values since SQL Server start:

- PAGEIOLATCH_SH: < 20 ms/requestTypical values are in the range of 4 to 10 ms/request.

- WRITELOG: < 10 ms/requestTypical values are in the range of 1 to 5 ms/request.When using these counters for short time intervals (as the 20minutes used in the SAP database monitor) reference valuestwice as high can be used.

5. How can I monitor the impact of I/O on the current database activity?The current database activity can be observed in ST04 -> 'Detail analysis menu' -> 'SQL processes'.To find processes waiting on I/O order by column 'Waittime'descending. Those processes with 'Waittime' <> 0 are currently waiting(ignore system processes). Column 'SQL wait resource' displays whatthe processes are waiting on. PAGEIOLATCH_SH or PAGEIOLATCH_EXindicates waiting on I/O on data files. For an indepth analysis thewait resource can be used to identify the file and the database objectwhere the wait occurs. WRITELOG indicates waiting on I/O ontransaction log files.

6. What else can I use to monitor SQL Server I/O?Most dedicated storage hardware comes with its own monitoringsoftware. For some products this software is only available with thevendors support.On all installations the System Monitor (Performance Snap-In ofMicrosoft Management Console or Performance Monitor) of Windows can beused for a detailed monitoring of the I/O. Sampling intervals from 10seconds to 5 minutes may be used.Note: Most counters are available separately for read and writeoperations and summed up for all operations. Depending on the level ofdetail of the analysis only the sum (e.g. "Avg disk sec / transfer")or the separate counters (e.g. "Avg disk sec / read" and "Avg disk sec/ writes") can be monitored. Below the counters for read and writeseparately are listed.

- To examine the response time of the I/O system use thecounters:

PhysicalDisk: Avg disk sec / read PhysicalDisk: Avg disk sec / writes

Based on these response times you can decide whether I/Ocontributes considerably to the database response times andtherefore the system performance is I/O bound.

- To identify an overload situation of the I/O system useadditionally the counters:

PhysicalDisk: Avg. Disk Read Queue Length

Page 4: Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

04.01.2011 Page 4 of 5

SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008I/O performance

PhysicalDisk: Avg. Disk Write Queue Length

Note that the '% Disk Time' counters are useless as they areidentical to the corresponding 'Avg. Disk Queue Length'counters.In case of an overload the response times deteriorate while thequeue lengths build up. The 'Current Disk Queue Length' can beused also, but has to be interpreted with care as it is asnapshot of a short-living value. These counters can also beused for a long term monitoring to identify hardwarebottlenecks in advance.

- To examine the throughput of the I/O system use the counters:

PhysicalDisk: Disk Read Bytes/sec PhysicalDisk: Disk Reads/sec PhysicalDisk: Disk Write Bytes/sec PhysicalDisk: Disk Writes/sec

Every I/O hardware comes with a technical specification for themaximum throughput. If the measured throughput saturates farbelow this specification, the hardware itself, or theconfiguration, or software is erroneous.The Microsoft whitepaper available on Microsofts SQL Serverhome page 'SAP with Microsoft SQL Server 2005: Best Practicesfor High Availability, Maximum Performance, and Scalability'discusses reference values for the System Monitor counters.

7. What can I do when I have identified an I/O bottleneck?I/O analysis can be complicated due to the many layers involved. Thisincludes the hardware (e.g. disks, host adapters, caches, andcontrollers), software (firmware, drivers, Windows operating system,and the RDBMS SQL Server), and their configuration. For mostcomponents the hardware partner is the best contact. General databaseand application tuning - including elimination of expensive SQLstatements - may reduce the I/O load. On the SAP Support Portal youfind information on SAP service offerings 'SAP Storage SubsystemOptimization' and 'SAP Business Process Performance Optimization' at http://service.sap.com/stso and http://service.sap.com/bppo.SQL Server 2005 doesn't have configuration parameters relevant forI/O. Therefore the administrative task reduces to a sensibleconfiguration of the database files. When SAP brought its product onSQL Server hardware and operating systems were already advancedenough, to support a very simple implementation which is in compliancewith todays paradigm of "striping data across all availableresources": all tables are put into one large pool, which isdistributed over all database files. This is fully managed by SQLServer alone. Therefore SQL Server installations do not suffer fromhot spots caused by misconfiguration of table storage. This eliminatesone of the layers presenting possible root cause for bad I/Operformance. The database administrator has to follow only few simplerules:

- No data file must be full.

- The free space within the data files is spread evenly over allfiles (more precisely it is sufficient to spread it evenly overall available I/O channels - where the meaning of 'I/O channel'

Page 5: Note 987961 - FAQ SQL Server 2005 - SQL Server 2008 IO Performance

04.01.2011 Page 5 of 5

SAP Note 987961 - FAQ: SQL Server 2005 - SQL Server 2008I/O performance

depends on the hardware).

Header Data

Release Status: Released for CustomerReleased on: 25.05.2010 09:21:50Master Language: EnglishPriority: Recommendations/additional infoCategory: FAQPrimary Component: BC-DB-MSS Microsoft SQL Server

Secondary Components:SV-BO Backoffice Service Delivery

The Note is release-independent

Related Notes

Number Short Text

1152848 FAQ: SQL Server Wait Events

521750 FAQ: SQL Server 2000 I/O performance

Attributes

Attribute Value

Database system MSSQL Server 2008

Database system MSSQL Server 2008 R2

Database system MSSQL Server 9.0