Performance Tuning Waits Queues
Performance Tuning Waits Queues
Performance Tuning Waits Queues
The information contained in this document represents the current view of Microsoft Corporation on the issues
discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the
accuracy of any information presented after the date of publication.
This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under
copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or
transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or
for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights
covering subject matter in this document. Except as expressly provided in any written license agreement
from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks,
copyrights, or other intellectual property.
Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses,
logos, people, places and events depicted herein are fictitious, and no association with any real company,
organization, product, domain name, email address, logo, person, place or event is intended or should be
inferred.
Microsoft, SQL Server, Windows, Window Server are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective
owners.
Table of Contents
Introduction ......................................................................................................1
Overview ...........................................................................................................1
Purpose .................................................................................................... 1
Audience: Who should read this paper .......................................................... 2
Waits and Queues: A Performance Methodology ...............................................2
Execution Model (simplified) ............................................................................. 3
Waiter List and Wait Types ............................................................................... 5
Dynamic Management Views (DMVs) and Functions (DMFs).................................. 5
Sys.dm_exec_requests ............................................................................... 5
Sys.dm_os_waiting_tasks ........................................................................... 5
Sys.dm_os_wait_stats ................................................................................ 6
Track_waitstats_2005 stored procedure ........................................................ 6
Get_waitstats_2005 stored procedure ........................................................... 6
Performance and Tuning Blue Prints .................................................................. 7
OLTP blueprint ........................................................................................... 7
Common scenarios to avoid in OLTP ............................................................. 7
DataWarehouse blueprint .......................................................................... 12
Common Scenarios to avoid with DataWarehousing ...................................... 12
Typical resource bottlenecks ........................................................................... 16
Memory pressure and IO subsystem issues ................................................. 16
IO Stalls ................................................................................................. 16
Missing or poorly formed indexes ............................................................... 17
Largest IO queries. ................................................................................... 18
Query optimizer, query plans and statistics ................................................. 18
Query plan reuse and DMVs ...................................................................... 19
Query plan reuse and Performance counters ................................................ 19
Statement level recompilation and DMVs..................................................... 20
Tracking down blocking issues. .................................................................. 21
Retrieving statements in the waiter list ....................................................... 22
SQL Server 2005 Wait Types and correlation to other Performance information .... 22
QUEUES (Perfmon Counters) .......................................................................... 79
PERFMON Counters, correlation, possible conclusions and actions .................. 79
Interesting PERFMON Ratios and comparisons ............................................. 89
Memory Issues ............................................................................................. 91
Comparison of 32-bit memory architecture vs. 64-bit flat memory ................. 91
64-bit flat memory vs. higher 32-bit clock speeds ........................................ 92
Application Design issues ............................................................................... 93
Recommendations...........................................................................................93
Conclusion.......................................................................................................93
SQL Server 2005 Waits and Queues 1
Introduction
This paper approaches the complex area of Microsoft® SQL Server™ performance
tuning using a methodology called Waits and Queues. By using this methodology one
can identify the best opportunities to improve performance, the so called “biggest bang
for the buck”. These performance improvements are likely to have a significant return
on the performance tuning time investment. The methodology helps identify the areas
of slow performance by looking at the problem from two directions. You, or another
troubleshooter, can use this to pinpoint problem areas by correlating data from two
sources: Waits and Queues. An analysis of Waits indicates where SQL Server is
spending lots of time waiting. In addition, the biggest waits point out the most
important or relevant Queues (that is, Performance Monitor counters and other data)
for this workload. The cross validation of the waits analysis enables us to eliminate all
except the most significant performance counters, and provides a strong indication of
pressure on specific resources.
In sum, Performance Tuning using the Waits and Queues methodology is an effective
way to quickly identify and resolve application performance problems because it lets the
user discover new and potentially unexpected problem areas, within applications or
solutions without the typical guesswork that can accompany such work.
Overview
Performance tuning of applications and solutions has been around for many years. The
performance of SQL Server 2005 database applications should be evaluated from
several different perspectives. Each perspective tells a different section of the complete
performance story. Together they paint a detailed performance picture of the whole and
also cross validate observations in each specific perspective.
We outline a methodology that considers performance from the perspective of
application, SQL Server, and correlates this to the system or resource perspective.
These perspectives are the primary inputs to the waits and queues methodology.
Be aware that some bottlenecks are more easily correctable than other bottlenecks. For
example, a lack of query plan reuse for ad hoc SQL can be resolved by either of two
methods: (1) using sp_executesql to parameterize the ad hoc SQL or (2) by replacing
ad hoc SQL with stored procedures. However, completing these application changes
takes time depending on the extent of the coding and testing requirements.
Purpose
The purpose of this document is to help developers and database administrators in
pinpointing areas in applications and solutions that interact with SQL Server 2005 and
can benefit from improved performance. This paper outlines a best practice
methodology and provides guidelines and thought processes to identify poor performing
applications in addition to providing insight into improvement regimes. It should be
noted that, although the concepts outlined in this paper can apply to all versions of
Microsoft SQL Server, the included examples are specific to SQL Server 2005 as they
use some new features not available in earlier versions.
This methodology can be put to most effective use in order to discover some of the
non-obvious performance issues and help in quickly identifying the root cause. There
are many papers and books on performance tuning and optimization techniques for
various versions of Microsoft SQL Server. This paper demonstrates features that are
specific to SQL Server 2005. It embodies knowledge from a range or sources including
the SQL Server development team in addition to specialist consultants working with
customers.
Queues measure system resources and utilization. The queues part of performance is
represented by Performance Monitor objects and counters and other sources of
information. Performance Monitor counters measure various aspects of performance
such as transfer rates for disks or the processor time consumed. SQL Server object
counters are exposed to Performance Monitor using the dynamic management view
(DMV) sys.dm_os_performance_counters. Thus, Performance Monitor counters show
performance from a resource point of view.
Application performance can be easily explained by looking at SQL Server waits and
System or Resource queues. In SQL Server 2005, the dynamic management view
(DMV) sys.dm_os_wait_stats provides a valuable source of wait information from an
application perspective. The system or resource perspective uses Performance Monitor
counters and other data sources to provide a breakdown of system resource usage
according to resource queues. Taken together, the value of the application and resource
perspectives used by the waits and queues methodology enables us to narrow in on the
bottleneck and eliminate the irrelevant performance data.
Figure 1: Execution Model – Running, runnable and suspended status, Runnable Queue
and Wait List
Figure 2 shows how SQL Server sessions rotate between the following statuses:
Running (only one session can be running or executing, per scheduler), Runnable
(sessions waiting for CPU), or Suspended. SPIDs with suspended statuses are placed
in Waiter List until the requested resources are available. If a running session needs a
data page that is not in cache, or needs a page that is blocked by another user’s lock,
the session is moved to the wait list. The next SPID or session_id in the runnable queue
is scheduled to start running.
Figure 2: Execution Model – How status changes affect SPIDs
Figure 3 depicts execution “after” session_ids (or SPIDs) have rotated clockwise due to
status changes.
The wait list means a thread has to wait for a resource. Example of resource waits
includes IOs to complete, a lock to be released, a memory grant, and so on. When the
session is moved to the wait list, a wait type is assigned and time is accumulated. When
the resource becomes available, the thread is moved to the runnable queue and it
executes as soon as the CPU is available. The clockwise rotation between running,
runnable and suspended states continues until the user request is completed.
Sys.dm_exec_requests
Each SQL Server session has a unique session_id in the system DMV
sys.dm_exec_requests. The stored procedure sp_who2 provides a list of these sessions
in addition to other connection information such as command, resource, wait types,
wait time, and status. User queries will have a session_id > 50. Common status
values are ‘running’, ‘runnable’ and ‘suspended’, as described in the Execution Model
discussion. A session status of ‘Sleeping’ indicates SQL Server is waiting for the next
SQL Server command.
Sys.dm_os_waiting_tasks
The waiter list that shows all waiting sessions and the reasons for the waits can be
found in the DMV sys.dm_os_waiting_tasks. The session_id, wait type, and associated
wait time can be seen. In addition, if the session is blocked from acquiring a lock, the
session holding (known as blocking) the lock as well as the blocked resource is shown in
the columns blocking_session_id and resource.
Sys.dm_os_wait_stats
Sys.dm_os_wait_stats is the DMV that contains wait statistics, which are aggregated
across all session ids since the last restart of SQL Server or since the last time that the
wait statistics were reset manually using DBCC SQLPERF ('sys.dm_os_wait_stats',
CLEAR). Resetting wait statistics can be helpful before running a test or workload.
Anytime a session_id waits for a resource, the session_id is moved to the waiter list
along with an associated wait type. The DMV sys.dm_os_waiting_tasks shows the
waiter list at a given moment in time. Waits for all session_ids are aggregated in
sys.dm_os_wait_stats.
OLTP blueprint
An OLTP application is characterized by a high volume of small identical transactions,
which frequently include SELECT, INSERT, UPDATE, and DELETE operations.
Unlike large data warehouse or reporting transactions where multiple CPUs work in
parallel, dividing up the query into smaller pieces, the small transactions of OLTP do not
require parallelism. Parallelism is multiple CPUs working in parallel, dividing up the
query into smaller pieces.
While a query is divided across multiple CPUs it will run faster, but it does so by
sacrificing CPU resources, as it requires merges and sorts of the smaller pieces before
presenting the final result set. An OLTP transaction is small to begin with so there is no
need for parallel operations that basically sacrifice CPU and memory resources for
speed of execution. Plus, with the high transaction volumes of OLTP, it is important not
to waste CPU resources. Parallelism is most appropriate for the big, low volume
transactions of data warehouse or reporting applications.
The implications are significant for database design, resource usage and system
performance.
OLTP Performance blue print objectives: There are likely to be performance and
scalability problems if any of resource issues the following tables are true.
Note The values in Value column are good starting point. The actual values will vary.
CPU
application would
not parallelize
unless an index is
missing, there is
an incomplete
WHERE clause, or
the query is not a
true OLTP
transaction.
Memory
4 SQL cache <90% SQL cache hit ratio falls It is likely that large
hit ratio under 90% for sustained scans have to be
periods of time greater performed, which in turn
than 60 sec. flushes out the buffer
cache.
IO
Blocking
LCK_M_IX
LCK_M_RIn_NL
LCK_M_RIn_S
LCK_M_RIn_U
LCK_M_RIn_X
LCK_M_RS_S
LCK_M_RS_U
LCK_M_RX_S
LCK_M_RX_U
LCK_M_RX_X
LCK_M_S
LCK_M_SCH_M
LCK_M_SCH_S
LCK_M_SIU
LCK_M_SIX
LCK_M_U
LCK_M_UIX
LCK_M_X
5 High number >5 per Trace flag 1204 to display If the deadlock occurs
of deadlocks hour in the errorlog and or the with the same
profiler deadlock graph. participant SQL
commands or
operations multiple
times, it is likely that
there is a locking
problem.
Network
Packets
Received Errors
In summary, given the high volume of identical small transactions that characterize
OLTP, transactions per second and resource usage can be improved as follows:
1. Database designs usually keep the number of indexes to a functional minimum as
every insert, update, and delete incurs index maintenance.
2. CPU can be reduced with plan reuse and join reduction.
3. IO performance can be reduced with good indexing, join reduction, and high page
life expectancy.
4. Memory is optimal when there are no sudden drops in Page Life Expectancy.
5. Sorts can be limited with index usage. That is, a certain sort order is supported by
an index that is sorted the same way, either ascending or descending.
6. Blocking can be reduced with index design and short transactions.
DataWarehouse blueprint
Compared to OLTP, data warehouse applications are characterized by low volumes of
large transactions. This workload profile is exactly the opposite of OLTP. Data
warehouse and reporting applications typically include big SELECT or read operations.
The implications are significant for database design, resource usage, and system
performance. Index fragmentation, cache turnover, and IO performance are often
important factors for these workloads.
Data warehouse performance blue print objectives: There are performance problems if
any of the resource issues in the following tables are true.
Note While the actual value in the value column could be debated, it is a good
starting point when identifying common performance problems with DataWarehousing
and Reporting applications.
should be scenarios.
<25%
3 Scans and >= 1 Perfmon object A missing index flushes the
ranges are SQL Server Access cache.
common. Look Methods
for missing
Sys.dm_db_missing_i
indexes
ndex_group_stats
Sys.dm_db_missing_i
ndex_groups
Sys.dm_db_missing_i
ndex_details
4 Unused If an index is NEVER used, it Index maintenance for
Indexes should will not appear in the DMV unused indexes should be
be avoided sys.dm_db_index_usage_stats avoided.
Resource issue: IO
LCK_M_IS blocks.
LCK_M_IU
LCK_M_IX
LCK_M_RIn_NL
LCK_M_RIn_S
LCK_M_RIn_U
LCK_M_RIn_X
LCK_M_RS_S
LCK_M_RS_U
LCK_M_RX_S
LCK_M_RX_U
LCK_M_RX_X
LCK_M_S
LCK_M_SCH_M
LCK_M_SCH_S
LCK_M_SIU
LCK_M_SIX
LCK_M_U
LCK_M_UIX
LCK_M_X
IO Stalls
The table valued dynamic management function, sys.dm_io_virtual_file_stats provides
a breakdown of SQL Server reads, writes, and io_stalls for a particular database or
transaction log file. IO_stalls is the total cumulative time, in milliseconds, that users
waited for I/O to be completed on the file since the last restart of SQL Server.
• Select * from sys.dm_io_virtual_file_stats (dbid,file#)
• Select * from sys.dm_io_virtual_file_stats (dbid,NULL) to list all files for a database.
If IO_stalls is inordinately high for one or more files, it is possible that there is either a
disk bottleneck or that high reads and writes are occurring on one drive. Average IO
Waits per read or write can distinguish between consistently high IO queues or a
temporary IO spike. A significantly higher average value for IO stalls on one particular
drive indicates consistently high IO requests. This should be corroborated with
Performance Monitor counters Physical Disk: Average Disk Seconds/Read and Average
Disk Seconds/Write. The following script can also compute the Average Disk
Seconds/Read and Average Disk Seconds/Write using sys.dm_io_virtual_file_stats.
---- average stalls per read, write and total
---- adding 1.0 to avoid division by zero errors
select database_id, file_id
,io_stall_read_ms
,num_of_reads
,cast(io_stall_read_ms/(1.0+num_of_reads) as numeric(10,1)) as
'avg_read_stall_ms'
,io_stall_write_ms
,num_of_writes
,cast(io_stall_write_ms/(1.0+num_of_writes) as numeric(10,1)) as
'avg_write_stall_ms'
,io_stall_read_ms + io_stall_write_ms as io_stalls
,num_of_reads + num_of_writes as total_io
,cast((io_stall_read_ms+io_stall_write_ms)/(1.0+num_of_reads +
num_of_writes) as numeric(10,1)) as 'avg_io_stall_ms'
from sys.dm_io_virtual_file_stats(null,null)
order by avg_io_stall_ms desc
select *
from sys.dm_db_missing_index_columns(@handle)
order by column_id
Largest IO queries.
The underlying purpose of an index suggested by sys.dm_db_missing_index_columns,
is to avoid doing large amounts of IO for the query in question. Therefore, you can
expect such queries to rank among the highest IO queries. To find the highest IO
queries, you can use the following sample code:
--- top 50 statements by IO
SELECT TOP 50
(qs.total_logical_reads + qs.total_logical_writes)
/qs.execution_count as [Avg IO],
substring (qt.text,qs.statement_start_offset/2,
(case when qs.statement_end_offset = -1
then len(convert(nvarchar(max), qt.text)) * 2
else qs.statement_end_offset end -
qs.statement_start_offset)/2)
as query_text,
qt.dbid,
qt.objectid
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_sql_text (qs.sql_handle) as qt
ORDER BY [Avg IO] DESC
For more information about SQL Server 2005 Query Optimizer, Query plans, and
Statistics refer to
http://www.microsoft.com/technet/prodtechnol/sql/2005/qrystats.mspx.
initial compilation occurs when a plan is not found in cache. OLTP applications should
have high plan reuse, > 90%.
Initial Compilations = SQL Compilations/sec – SQL Re-Compilations/sec
Plan reuse = (Batch requests/sec – Initial Compilations/sec) / Batch
requests/sec
Memory pressure can cause query plans to be discarded and therefore result in reduced
plan reuse. See OLTP Blueprints for memory pressure.
objectid
from sys.dm_exec_query_stats as qs
Cross apply sys.dm_exec_sql_text(sql_handle) sql_text
where plan_generation_num >1
order by sql_handle, plan_generation_num
3. WRITELOG
4. LOGMGR
Average Average of disk queues over Confirm IO issues with disk sec/read
Disk Queue time. If this number is and disk sec/write. Waitstats
Length consistently high, disk correlation:
sec/read and disk sec/write is 1. IO_COMPLETION
also high indicating IO
2. ASYNC_IO_COMPLETION
bandwidth issues.
3. WRITELOG
4. LOGMGR
Disk Under typical circumstances, If disk sec/read > normal read time
Sec/Read reads should take 4-8 ms (ask vendor for typical read time) you
(confirm with hardware vendor can consider the following options:
for exact read time). Sustained 1. Resolve IO bottleneck by adding
queues skew this number more drives; spreading IO across new
higher because disk sec/read drives if it is possible. For example,
factors in the effects of disk move files such as database,
queues. High numbers mean transaction log, other application files
your IO subsystem is not that are being written to or read from.
keeping up with requests
2. Check for memory pressure, see
Check individual drive memory component.
performance if there are
3. Check for appropriate indexing of
multiple drives. If it is a broad
SQL tables. Correct indexing can save
problem affecting all drives,
IO. Check SQL query plans looking for
the IO subsystem is not
scans and sorts, and so on. Showplan
keeping up. More drives could
identifies sorting steps.
be useful. If there is ONE very
hot drive, examine disk activity 4. Run SQL Profiler to identify
such as location of paging file, Transact-SQL statements doing scans.
database, transaction log, and In Profiler, select the scans event
other read/write activity. class and scan stopped event. Click
the data column tab and add object
Id. Run the trace. Save the profiler
trace to a trace table, and then search
for the scans event. Alternatively, you
can search for high duration, reads,
and writes.
Waitstats correlation:
1. IO_COMPLETION
2. ASYNC_IO_COMPLETION
3. WRITELOG
4. LOGMGR
Disk Under typical circumstances, See disk sec/read.
Sec/Write reads should take 4-8 ms High performance (significant insert,
(confirm with hardware update, and delete activity) requires
vendor). Sustained queues the transaction log to be on a
skew this disk sec/write higher
Page This counter includes both hard faults Check for memory pressure
Faults/sec (those that require disk access) and soft (see SQL Server buffer
faults (where the faulted page is found manager), low data page hit
elsewhere in physical memory.) Most rates, and memory grants
processors can handle large numbers of pending, page life expectancy.
soft faults without significant
consequences. However, hard faults,
which require disk access, can cause
significant delays. See the disk
component for more information.
Full The entire table or index is SQL Profiler can be used to identify
Scan/sec scanned. Scans can cause which Transact-SQL statements do
excessive IO if an index would scan. Select the scans event class and
be useful. events scan:started and
scan:completed. Include the object Id
data column. Save the profiler trace to
a trace table, and then search for the
scans event.
The scan:completed event provides
associated IO so that you can also
search for high reads, writes, and
duration.
Index Number of index searches. Compare to Full Scan/sec. You want to
Searches/ Index searches are used to see high values for index searches.
sec start range scans, single index
record fetches, and to
reposition in an index.
Page Number of page splits Page splits are extra IO overhead that
Splits/sec occurring as the result of index results from random inserts.
pages overflowing. Typically When there is no room on a data page,
associated with leaf pages of and the row must be inserted on the
clustered indexes and non- page (because of index order), SQL
clustered indexes. splits the page by inserting a new row
and moving the rests of the rows to a
new page.
Compare to Disk: page sec/write. If
this is very high, you might want to
reorganize the indexes on the tables
causing the page splits, to reduce page
splits temporarily. Fillfactor can be
used to leave space for inserts.
Correlate to Waittype
1. RESOURCE_SEMAPHORE
Cache Hit Percentage of time Check for memory pressure. See Checkpoint
Ratio that the procedure pages/sec, Lazy writes/sec and Page life expectancy.
plan pages are See SQL Profiler: Stored Procedure: CacheHit,
already in cache. CacheMiss, and CacheInsert to see what stored
For example,. procedure query plans are already in cache (Hit) vs.
procedure cache those not in cache (Miss,Insert)
hits. That is, how
Check for appropriate plan reuse. See section “Query
frequently a
Plan Reuse”. It is frequently desirable for query plans
compiled
to be reused for similar SQL although not always.
procedure is found
in the procedure See SQL Statistics: Compilations/sec for discussion
cache (therefore of plan reuse.
avoiding the need If there is memory pressure, plans are discarded to
to recompile). make room for other data or procedure plans.
second
User Number of user
connections connections
context switching threads instead of actively running given threads. This kind of
scenario was visible on Microsoft Windows 2000 Server. In Windows Server® 2003
it is less likely but can still occur.
5. Disk Queue Length versus Disk sec/Transfer. As disk queue length increases,
so does disk sec/transfer.
Performance monitor counters are PhysicalDisk:Avg Disk Queue Length and
PhysicalDisk:Avg Disk sec/Transfer.
6. Page life expectancy, checkpoint pages/sec, lazy writes/sec comparison.
Memory pressure is indicated with low page life expectancy, and high checkpoint
pages and lazy writes/sec. Memory pressure, which adversely affects performance,
can be lessened one or more of the following
a. Adding more memory to the box
b. Increasing SQL memory
c. Avoiding table and index scans with appropriate indexing
7. SQL buffer cache hit ratio. If this is consistently under 90% it indicates that the
buffer cache is getting flushed.
8. Signal waits and the runnable queue comparison. Basics of execution model
(simplified) is as follows.
a. If a session id is running and must lock a resource that is unavailable at the
time, it moves to the resource wait list (time T0).
b. A signal indicates resource available, SPID moves to runnable queue at time T1.
c. SPID waits running status until T2 as CPU goes through the runnable queue in
order of arrival
d. The resource wait time is the actual time waiting for the resource to be
available, Time T0 to T1.
e. The signal wait time spent in the runnable queue. It starts from the time the
resource is available (T1) to the point in which the process is running again at T2.
Therefore, signal waits are T2-T1.
The larger the value T1 – T0 = means that the particular resource availability is
tending to be more limited. If it is a lock that is waiting then blocking could likely
be occurring. If it is IO that is waiting then the disk subsystem is likely to be
bottlenecking.
T2 – T1 indicates CPU pressure. This indicates that as the value increases the
time that is spent in the runnable queue also increases. Session_ids in the
runnable queue are waiting only for CPU resource. If this is say >25%, there is a
CPU bottleneck.
f. Key questions: Are Resource and Signal time significant?
• Highest waits indicate the bottleneck you need to solve for scalability
• Generally if you have LOW% SIGNAL WAITS, the CPU is handling the
workload. For example, session_ids move through runnable queue quickly
• HIGH % SIGNAL WAITS indicates CPU cannot keep up, significant time for
SPIDs to move up the runnable queue to reach running status
9. Network: Current bandwidth, bytes total/sec, packets/sec. Network
bandwidth issues should be corroborated with bytes total/sec. [Network interface:
bytes total/sec] / [Network interface: Current Bandwidth] > .6, possible network
bottleneck.
10. Page Faults/sec versus Pages/sec. Page faults include both hard faults (those
that require disk access) and soft faults (where the faulted page is found elsewhere
in physical memory). Most processors can handle large numbers of soft faults
without significant consequences. However, hard faults, which require disk access,
can cause significant delays. Pages/sec represents the number of hard page faults
that require physical IO to bring the pages into memory.
Memory Issues
The SQL Server relational database system uses memory for many different purposes
internally. For a complete discussion of the memory uses in SQL Server, see
http://www.winnetmag.com/Article/ArticleID/43419/43419.html.
To summarize, the main uses are as follows:
1. Database page cache, which is used to cache database (table / index) pages
2. Query Workspace memory, which is used by memory intensive query operations
such as Hash and Sort.
3. Plan cache, which is used to cache query plans so that they can be reused
4. Other; such as locks, connection memory, thread stacks, memory for utilities such
as backup/restore and so on.
5. Memory used by other components linked into the SQL Server process such as XPs,
OLE-DB providers and so on. The memory is typically referred to as the
MemToLeave memory area because SQL Server refrains from allocating this
memory so that these other components linked into the process can do so.
Recommendations
The Waits and Queues methodology is recommended as the most effective technique
for identifying and resolving performance issues. It focuses on the best opportunities to
improve performance, the so called “biggest bang for the buck”. These performance
improvements are likely to have a significant return on the performance tuning time
investment.
Conclusion
There are two complimentary sources of performance information for SQL Server. Wait
types are an invaluable clue in analyzing overall system performance from an
application point of view. Wait types provide a view of system performance from a SQL
thread standpoint while Performance Monitor provides a view of system performance
from a resource standpoint.
Wait statistics should be corroborated or associated with resource counters in
Performance Monitor. For example, a high SQL Server wait types signal the need for
additional PERFMON investigation of underlying resources such as processor, IO
subsystem, network and so on. Together, these associations or correlations of wait
types to performance counters, and other related counter ratios provide a broad picture
of application performance.
In come cases, the experienced performance expert must look beyond the symptom to
find the root problem. Although not exhaustive, the correlated performance
information, possible conclusions and actions, and interesting ratios and comparisons
sections shed light on actual root problems, given the symptoms. The waits and queues
methodology presented here, identify system bottlenecks and propose additional
corroboration and conclusions, where appropriate.
In sum, the performance methodology of waits and queues draws on the available
performance information that consists of waitstats, PERFMON counters, and correlated
Did this paper help you? Please give us your feedback. On a scale of 1 (poor) to 5
(excellent), how would you rate this paper?