30.06.2013 Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Viewing pending I/O requests<br />

Chapter 6: Physical Disk Statistics and Utilization<br />

Whereas the data in the the sys.dm_io_virtual_file_stats DMF is cumulative, the<br />

sys.dm_io_pending_io_requests DMV returns a row for each currently pending I/O<br />

request, so it is interesting from the standpoint of seeing what is happening right now,<br />

at the file level. This is a useful tool for analyzing disk I/O at a more granular level than is<br />

allowed by tools such as Profiler, which will summarize I/O activity at the drive level.<br />

Each time you query this DMV, it's likely that a different set of processes will be pending,<br />

so the returned data will vary each time. However, if you frequently see what seems like a<br />

high number of pending I/Os, this is evidence of some level of I/O bottleneck. Obviously,<br />

"high" is a matter of interpretation, but more than two or three could indicate an issue.<br />

This DMV returns several columns that are occasionally useful, including:<br />

• io_completion_request_address – address of the I/O request<br />

• io_type – type of I/O, for example 'disk'<br />

• scheduler_address – relates to sys.dm_os_schedulers to get information<br />

about the scheduler coordinating this I/O request<br />

• io_handle – handle for the file that is the target of the I/O request; relates to<br />

sys.dm_id_virtual_file_stats.file_handle to get the file information.<br />

However, the most interesting columns returned by this view, and the ones we'll use in<br />

our script, are:<br />

• io_pending – an integer value that indicates whether an I/O request is pending<br />

(returns 1) or has been completed by Windows but not yet processed by <strong>SQL</strong> <strong>Server</strong>,<br />

since it has not yet performed the context switch (returns 0); we know that the item is<br />

pending for the <strong>SQL</strong> <strong>Server</strong> storage engine, as this is the purpose of the DMV<br />

247

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!