Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Data Management

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « SQL Server DBA Tip 9 – SQL Server Monitoring – Default TraceSQL Server DBA Tip 7 - Server Security and grouping – Schema Control »
    comments

    Troubleshooting any type of problem can be stressful and tedious.  SQL Server performance issues are no exception.  If an instance of SQL Server suddenly shows a spike or immediate bottleneck with one or many resources, determining the cause of that spike can test any DBA’s patience. 

    What can make troubleshooting a performance problem in SQL Server more confusing is the lack of a true baseline.  A baseline can be any set of metrics that have been recorded about SQL Server.  Baselines will show normal operating behavior and, more importantly, show a DBA a true problem verses a normal tasking effect of the usage of your database server.

    Conclusion and using a Baseline

    This tip has covered briefly what a baseline is, why to create baselines and some resources to start collecting the information.  What was not covered yet is how to use them.  A baseline has one purpose or answer to a question: Is the current performance of SQL Server abnormal?  With a baseline you can identify:

    • When normal spikes occur in SQL Server resource consumption
    • When wait statistics may show longer waits than normal (wait statistics is a wide range of reasons or resources being used that may make performance slower)
    • What “normal” performance is for given SQL Server instance

    When we know the answers to these three items, we can make a more informed decision on when a problem is a problem.  Without a baseline, a 20% average in CPU for an hour timespan may concern us.  That could take time for a DBA to research and troubleshoot, and then start down a path that may end without a solid answer.  In some extreme cases, a DBA may make the decision to start running resource intense operations during normal business hours.  That decision itself could cause a performance problem while the problem it was intended to solve was not a problem at all. 

    We can see why a baseline can hold such value.  It is never too late to start collecting baselines for a SQL Server installation.  If your SQL Server(s) have been running for years and you simply know when they run well and may run poorly, you provide additional validity by having data collected, thereby providing hard evidence as to why SQL Server behaves differently at different times.

    Start with SQL Server DMVs

    When you start a position as a DBA or find yourself with SQL Servers that do not have a baseline, there are many tools that you can use to start building a baseline repository.  SQL Server Integration Services coupled with DMVs can pull in periodic snapshots of the state of SQL Server.   After exploring the data captured from the DMVs, use Performance Monitor to collect the remaining metrics to establish a solid baseline which will act as the starting point to identify a true problem in your SQL Server instances. 

    When configuring a baseline collection process, ensure that the type of collections match the SQL Server usage guidelines.  If you are using SSRS and SQL Server Engine on the same physical server, add in metrics that are common to SSRS. These may include more network related metrics as SSRS serves requests for reports. 

    Taking a snapshot of information using the SQL Server DMVs is a sound and quick method to begin collecting baseline data.  One way that you can begin automating and setting this retrieval of collecting DMV information is to use the Codeplex project SQL DMVStats. This comprehensive project collects a large amount of information and the majority of setup and configuration work has already been for you.  Using the information in the many DMVs that exist on SQL Server holds value outside of these projects that are available.  Running basic collections on specific DMVs (e.g. dm_exec_wait_stats every five to ten minutes) can provide useful information regarding times of the day or week where waits are higher than others. 

    After collecting internal SQL Server information, setting up Performance Monitor (perfmon) to capture server statistics can be done.  This will collect information about all the resources on the server that will show exactly how well, over a given time period, the server is responding and performing for SQL Server.   The performance counters you choose can be altered slightly given the type of installation you are running.  A beginning list of counters that you can start with, as well as information on setting perfmon up and collecting these, can be found on BrentOzar.com.

    Schedule Baseline Collection

    The last thing you want to do is rely on baselines gathered by manually checking SQL Server here and there.  The collections should be fully automated, and based on reviews of reporting from the collected information.  The SQL Server Performance Dashboard is a great example of ways to review snapshots of performance metrics.  (Note: the link used is a fix posted by Rob Carrol for 2008.  Download the SQL Server Performance Dashboard version 2005 first, and then make this change.)

    Third Party Help

    Using the assistance of a third party solution to gather statistics on SQL Server is a good option to explore.  These solutions provide a vast amount of detail about SQL Server performance while freeing time of a DBA to handle other priorities.  Later in this series there will be a tip that revolves around third party software that can assist in monitoring and collection of performance statistics vendor support for SQL Server.  Look for that tip for a more in-depth look at why third party software can assist you in being more efficient with baselines and other aspects of DBA tasks.

    Notable

    A few months before writing this article I attended, presented and help organize SQL Saturday in Chicago.  During that event I sat in on Erin Stellato’s (Twitter | Blog) session, “Baseline First, Troubleshooting Second”.  This presentation was excellent and went over this very topic.  Being a strong believer that you can become far more stable and efficient as a DBA by taking the necessary steps, like baselines, first in an environment, I thoroughly enjoyed the session.

    If you have the opportunity to have Erin come near your area and she is presenting this session, or any other, I strongly encourage attending.  You will see the tools that this “Tip” did not go in-depth over.  Tools such as, PerfMon, PAL, Profiler, RMLUtils and on were mentioned, used and demonstrated. 

    Thanks to Erin and all the other presenters for sharing their knowledge on this and many other topics we otherwise would learn the hard way. 

    About the Author

    Ted Krueger is a SQL Server MVP and has been working in development and database administration for 13+ years. Specialties range from High Availability and Disaster / Recovery setup and testing methods down to custom assembly development for SQL Server Reporting Services. Ted blogs and is also one of the founders of LessThanDot.com technology community. Some of the articles focused on are Backup / Recovery, Security, SSIS and working on SQL Server and using all of the SQL Server features available to create stable and scalable database services. @onpnt Personal Blog over at http://onpnt.wordpress.com/
    Social SitingsTwitterLinkedInLTD RSS Feed
    3902 views
    InstapaperVote on HN

    5 comments

    Comment from: Grant Fritchey [Visitor] · http://scarydba.com
    Grant Fritchey Nice article. But it didn't give one piece of information that is constantly asked, how far back do you maintain a baseline? A year, six months, 1 month?
    05/05/11 @ 06:39
    Comment from: Ted Krueger (onpnt) [Member]
    Ted Krueger (onpnt) Good point, Grant.

    I keep baselines forever and build on them but base everything on a 13 month rotation. The 13 months is because you have to consider year-end. The month after a fiscal year ends will be a heavy reporting time and that time in the baseline is critical to knowing how to deal with it (or more so, prepare).

    Baseline information should be collected all the time so you have the evolving view of how everything works. You review the activity for a week, month and year then to know your baseline activity during those times. Each business and how they use data is completely different as well (in most cases). Week 26 in a fiscal run may be hard hit while company two has a week 5 that is a killer.

    You have to have that evolving information to know this.

    Next question someone will ask is, "How is that different from real-time monitoring?" It's a lot different in the retention time you would keep for active monitoring for one. You don't keep a year of SQL Monitor data. At least I don't. The stats that you monitor there are heavier and it adds up faster. Real-time monitoring is for reactive troubleshooting. Baselines are for proactive troubleshooting and for use in your reactive troubleshooting of real-time. Meaning, using your baseline in the event real-time monitoring has problems as another piece of information to troubleshoot.
    05/05/11 @ 06:49
    Comment from: Grant Fritchey [Visitor] · http://scarydba.com
    Grant Fritchey Excellent stuff. Thanks for posting it.
    05/05/11 @ 07:01
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) Pretty sure you aren't very stable.
    05/06/11 @ 06:31
    Comment from: Dirk Hondong [Visitor] Email · http://dirkhondong.wordpress.com
    Dirk Hondong Hi Ted,

    nice article and a good overview about baselines.
    I also recognized another of your blog posts (http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/sql-server-baseline-creation) and in the comments you´ve mentioned a SSIS solution. I´m looking forward to it once it´s available @ codeplex.

    Regards
    Dirk
    06/17/11 @ 02:37

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)