18.11.2012 Views

SQL Server Contention: Diagnosing and Resolving ... - Quest Software

SQL Server Contention: Diagnosing and Resolving ... - Quest Software

SQL Server Contention: Diagnosing and Resolving ... - Quest Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SQL</strong> <strong>Server</strong> <strong>Contention</strong>:<br />

<strong>Diagnosing</strong> <strong>and</strong> <strong>Resolving</strong><br />

Blocking Problems<br />

John Theron<br />

Director of Product Management<br />

<strong>SQL</strong> <strong>Server</strong> Solutions


Agenda<br />

� What is blocking?<br />

� Blocking in every day life<br />

� Locking basics<br />

� The impact of locking<br />

� Detecting, diagnosing <strong>and</strong> resolving<br />

blocking


Blocking<br />

� Occurs when one transaction locks<br />

the data resources that another<br />

wants to read or modify<br />

CustomerID<br />

10653<br />

10654<br />

CompanyName<br />

<strong>Quest</strong> <strong>Software</strong><br />

Ace Consulting<br />

ContactName<br />

Jim<br />

S<strong>and</strong>y


<strong>Contention</strong><br />

� Is inevitable as multiple users<br />

compete for resources<br />

� Is common in our daily lives


Lock Granularity<br />

� Row, page, table, index <strong>and</strong> index<br />

range<br />

� Also extent, application <strong>and</strong> database<br />

� Escalation occurs when row <strong>and</strong> page<br />

locks are promoted to table locks


Lock Compatibility<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

Sch-S<br />

N<br />

Y<br />

N<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

Sch-M<br />

N<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

BU<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

X<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

N<br />

N<br />

N<br />

Y<br />

SIX<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

Y<br />

N<br />

N<br />

Y<br />

IX<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

N<br />

N<br />

Y<br />

Y<br />

U<br />

N<br />

Y<br />

N<br />

N<br />

N<br />

N<br />

Y<br />

Y<br />

Y<br />

S<br />

N<br />

Y<br />

N<br />

N<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

IS<br />

Sch-S<br />

Sch-M<br />

BU<br />

X<br />

SIX<br />

IX<br />

U<br />

S<br />

IS<br />

Lock<br />

Mode


Transaction Isolation<br />

� Read Uncommitted<br />

� Read Committed<br />

� Read Repeatable<br />

� Read Serializable


Measuring the Impact<br />

Seconds<br />

120<br />

100<br />

80<br />

60<br />

40<br />

20<br />

0<br />

Transaction Times<br />

Baseline Wait Serializable Table Lock<br />

Ave<br />

Max


<strong>Diagnosing</strong>: Where to Start?<br />

trace flag 1200<br />

syslockinfo<br />

enterprise manager<br />

sp_lock<br />

sp_who<br />

DBCC<br />

performance monitor<br />

sysprocesses


The Diagnostic Process<br />

� Detect Blocking<br />

� Underst<strong>and</strong> the Chain<br />

� Determine the Extent of the Problem<br />

� Determine What locks the Lead<br />

Blocker is Holding<br />

� Underst<strong>and</strong> the Blocking Transaction


Demonstration


<strong>Resolving</strong> Blocking<br />

� Look beyond problem statements to<br />

the application <strong>and</strong> database design<br />

� Use your knowledge of your<br />

application <strong>and</strong> database to choose<br />

appropriate locking strategies


Conclusion<br />

� As applications scale <strong>and</strong> the number of<br />

users grows, contention for data resources<br />

becomes inevitable.<br />

� Good design will reduce the impact of<br />

blocking.<br />

� Tools <strong>and</strong> processes to speed the<br />

detection, diagnosis <strong>and</strong> resolution of<br />

blocking problems are important.


<strong>Quest</strong> Facts<br />

� <strong>Quest</strong> <strong>Software</strong> (NASDAQ:QSFT)<br />

– Founded 1987<br />

– Public in 1999<br />

� 1700 employees in 40 offices:<br />

– North America, South America,<br />

Europe, Asia, Australia<br />

� Application management leader:<br />

– 75% of Fortune 500<br />

– over 18,000 customers worldwide<br />

� 2003 revenues of $304 million<br />

– 19% growth from FY02<br />

� Helps develop, deploy, manage <strong>and</strong><br />

maintain enterprise applications without<br />

downtime or business interruption


What is <strong>Quest</strong> Central?<br />

� Single solution with multiple platform support<br />

– DB2, UDB, Oracle, MS <strong>SQL</strong> <strong>Server</strong><br />

– Z/os, OS/390, Unix, Linux, <strong>and</strong> Windows<br />

� Rich domain functionality<br />

– Database Administration<br />

Oracle<br />

– <strong>SQL</strong> Tuning<br />

DB2<br />

– Historical Performance Data<br />

– Space Management<br />

– Performance Diagnostics<br />

� Built-in Expertise<br />

– Built-in Knowledge Base<br />

– Product automates tuning methodology<br />

<strong>SQL</strong> <strong>Server</strong>

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

Saved successfully!

Ooh no, something went wrong!