how to write a sql server performance review

35
Copyright © 2007 Quest Software Brent Ozar, SQL Server Expert for Quest Software How to Write a SQL Server Performance Review http://flickr.com/photos/ sean002/2510541359/ Photo Licensed with Creative Commons

Upload: quest-software

Post on 24-Dec-2014

2.297 views

Category:

Technology


1 download

DESCRIPTION

Learn how to write a report that managers and developers will love. Use Perfmon and Profiler to document your application's bottlenecks, and turn those into a reader-friendly report.

TRANSCRIPT

Page 1: How To Write A SQL Server Performance Review

Copyright © 2007 Quest Software

Brent Ozar, SQL Server Expert for Quest Software

How to Write a SQL Server Performance Review

http://flickr.com/photos/sean002/2510541359/Photo Licensed with Creative Commons

Page 2: How To Write A SQL Server Performance Review

What The Heck Do I Know?• SQL Server Expert

for Quest Software• Former SQL DBA, SAN

admin, VMware admin• Recovering ASP coder• Specializes in

performance tuning• Came up through

management, not IT

Page 3: How To Write A SQL Server Performance Review

Today’s Agenda• The Deliverable• Gathering The Data• Finding the Problems• Mitigating the Problems• Writing the Report• Resources and Q&A

Page 4: How To Write A SQL Server Performance Review

The Deliverable: A Report

Page 5: How To Write A SQL Server Performance Review

Key Parts of Our Review• Capture objective, definitive and

credible metrics• Analyze problems causing bad metrics• List of ways we could mitigate each

problem

Page 6: How To Write A SQL Server Performance Review

Definitive Metrics• Start with Perfmon:

www.BrentOzar.com/perfmon• Gather for longest time possible• Check results daily to refine metrics

Page 7: How To Write A SQL Server Performance Review

Tracing the Problems• Focus the trace on the problem

statistics (CPU, reads, writes)• Filter duration > 2000ms at first• Refine duration filter down over time• Put results in a different SQL Server

– Very fast server, faster than what you’re tracing– Write into a simple mode database, no backups

Page 8: How To Write A SQL Server Performance Review

Querying the Trace Table

Page 9: How To Write A SQL Server Performance Review

ORDER BY Duration DESC

Page 10: How To Write A SQL Server Performance Review

Casting and Grouping

Page 11: How To Write A SQL Server Performance Review

Correlate the Metrics & Queries• Demonstrate good investigation skills• Show a cause and effect relationship• Fields to mentally “join” on:

– Date/Time ranges– CPU– Reads/Writes– Duration

Page 12: How To Write A SQL Server Performance Review

DO NOT FIX ANYTHING YET!• No matter how easy it looks• No matter whose fault it is• You have to show fruits from your labor• We want clear before & after snapshots• Worst thing we can tell our bosses:

“It’s OK now. I didn’t change much.”

Page 13: How To Write A SQL Server Performance Review

Mitigations For Each Problem

Photo From:http://flickr.com/photos/sneakums/1345233680/

Page 14: How To Write A SQL Server Performance Review

A Problem Has Many Mitigations• EVERY problem has multiple choices:

– Money– Time– Manpower

• Go out of your way to identify all of them

Page 15: How To Write A SQL Server Performance Review

Explain Mitigations That Suck• Shows you know about the option• May come in handy for another problem• Explain why it doesn’t work in this case• Displays wise decision-making• The PM may know something you don’t

Page 16: How To Write A SQL Server Performance Review

Be Willing To Implement Them

Photo From: http://flickr.com/photos/ninjapoodles/1130650313/

Page 17: How To Write A SQL Server Performance Review

Sample Problem• Metric:

– Very high disk queue lengths on data file drive

• Trace tells us:– Report queries doing

table scans without indexes

– Many scheduled reports run simultaneously

Page 18: How To Write A SQL Server Performance Review

Ways We Can Mitigate It• Add indexes• Run reports serially, not all at once• Add hard drives to the data file array• Add memory to cache scanned tables

Page 19: How To Write A SQL Server Performance Review

Percent vs Order of Magnitude• Incremental (Percentage):

– Any improvement from 1% to 100%.

• Order of Magnitude:– Any improvement over 100% faster.

• How to explain it in your doc:– This mitigation should give an incremental

(percentage) improvement.– This mitigation should give an order of magnitude

improvement.

Page 20: How To Write A SQL Server Performance Review

How To Explain It To Readers In this performance review, I classify mitigations as

giving us a Percentage Improvement (meaning 1-100% faster) or an Order of Magnitude Improvement (meaning over 100% faster).

In addition, because we’re talking about making multiple improvements simultaneously across different parts of the app and server, it’s hard to give exact numbers when one improvement might impact another area. A new index or server configuration change might improve performance for more than just one query or process.

Page 21: How To Write A SQL Server Performance Review

This Is How DBAs Write:

Page 22: How To Write A SQL Server Performance Review

Use A Different Way of Writing• Be friendly and upbeat – ideas at:

http://delicious.com/brento/powerpoint• Document like a consultant• Write like you’re an outsider looking in• Create clear, concise steps that

managers can assign to people

Page 23: How To Write A SQL Server Performance Review

Don’t Point Fingers

Page 24: How To Write A SQL Server Performance Review

Goal: Progress, Not Debating

Page 25: How To Write A SQL Server Performance Review

Moving Your Career Forward

Page 26: How To Write A SQL Server Performance Review

Your Target Reader…• Reads Fortune,

not SQL Magazine• Doesn’t understand

indexes or locks• Wants answers,

not questions• Only reads the

section headers

Page 27: How To Write A SQL Server Performance Review

The Executive Summary

Page 28: How To Write A SQL Server Performance Review
Page 29: How To Write A SQL Server Performance Review

(Bunch of stuff here clipped out)

Page 30: How To Write A SQL Server Performance Review
Page 31: How To Write A SQL Server Performance Review
Page 32: How To Write A SQL Server Performance Review
Page 33: How To Write A SQL Server Performance Review
Page 34: How To Write A SQL Server Performance Review

Wrapping It Up• Gather data with Profiler & Perfmon• Analyze the queries like it’s BI• Make a list of mitigation options• Write an upbeat, positive report• Aim for forwards, not replies• Save your reports for raise time!

Page 35: How To Write A SQL Server Performance Review

My Resources, Your Questions• My blog about SQL and performance:

www.BrentOzar.comwww.BrentOzar.com/perfreport

• My bookmarks:Delicious.com/brento

• SQL Server community w/expert Q&A:SQLServerPedia.com

• Performance tools for a second opinion:www.Quest.com