Search results matching tags 'Performance', 'monitoring', and 'workload improvements'http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&tag=Performance,monitoring,workload+improvements&orTags=0Search results matching tags 'Performance', 'monitoring', and 'workload improvements'en-USCommunityServer 2.1 SP2 (Build: 61129.1)Using Qure Workload Optimizer for SQL Sentryhttp://sqlblog.com/blogs/aaron_bertrand/archive/2011/04/21/using-qure-workload-optimizer-for-sql-sentry.aspxThu, 21 Apr 2011 11:50:00 GMT21093a07-8b3d-42db-8cbf-3350fcbf5496:35067AaronBertrand
<p>Last week at <a href="http://www.sqlbits.com/" title="http://www.sqlbits.com/" target="_blank">SQL Bits #8</a> in Brighton, England, <a href="http://sqlsentry.net/" title="http://sqlsentry.net/" target="_blank">SQL Sentry</a> (my employer) announced its partnership with <a href="http://dbsophic.com/" title="http://dbsophic.com/" target="_blank">DBSophic</a>, makers of the Qure workload management suite. Qure Workload Optimizer is a tool aimed at analyzing a workload and providing suggestions to improve the overall performance of that workload. These suggestions can range from adding and dropping indexes, to changing schema, to completely re-writing queries and batches. How does Qure differ from other products out there aimed at improving performance? Qure works against a copy of your production database, makes actual changes, and tests the workload against those changes to make sure they lead to better performance - leading to the absolute best recommendations that have actually been proven to improve your workload. If you aren' already excited about the potential here, I suggest you read this paragraph again. :-)
</p>
<p>You can read more about the partnership in <a href="http://www.prnewswire.com/news-releases/sql-sentry-partners-with-dbsophic-power-suite--qure-quick-start-pack-announced-119393174.html" title="http://www.prnewswire.com/news-releases/sql-sentry-partners-with-dbsophic-power-suite--qure-quick-start-pack-announced-119393174.html" target="_blank">this press release from April 7th</a> and also in the following blog post by Greg Gonzalez (<a href="http://twitter.com/SQLsensei" title="@SQLsensei">twitter</a>): <a href="http://greg.blogs.sqlsentry.net/2011/04/sql-sentry-v61-something-old-several.html" target="_blank">SQL Sentry v6.1: Something Old, Several Things New</a>.<br>
</p>
<p>The way that the base Qure product currently works is as follows:</p>
<ol>
<li>on the production server, you create a trace using a template provided by DBSophic, preferably covering a complete business cycle;<br></li>
<li>on a server dedicated for the analysis, you restore a backup of the production database;</li>
<li>once your trace is complete, you point Qure at the trace files (or table) and to the backup of the database, and run the analysis.<br></li>
</ol>
<p>In the bundled version created exclusively for SQL Sentry, you bypass step 1 and simply point Qure at the SQL Sentry v6 repository that has been monitoring your server. So instead of having to set up a trace and run it yourself, you can use what SQL Sentry is already doing for you. Note that this is limited to the last 100,000 trace events, but will also include up to the last 100,000 QuickTrace events as well - so if you have been running QuickTraces on your server, this data will be factored in as well.
</p>
<p>Before starting, it's a good idea to have SQL Sentry cover a complete business cycle with the "Top SQL" duration threshold tuned down to something lower than the default (5 seconds). Essentially you want to include as many events as possible; this way, the impact of any recommended changes can truly be tested. Even if an operation currently only takes 2 seconds, a change to benefit some other query might adversely affect some of these shorter queries.<br></p>
<p>That said, here is a step-by-step flow of how this works. (Click on any screen shot to show full size.)
</p>
<p>When you launch the program, you will see the splash screen looks a little bit different:<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo01.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo01.png" alt="Qure Workload Optimizer for SQL Sentry splash screen" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Qure Workload Optimizer for SQL Sentry splash screen</font></blockquote>
<p>Next, you'll choose "Start New Analysis" and you will be asked if you want to perform a full analysis or a trial analysis. For our purposes here, let's use a trial analysis. This will mean a limited set of recommendations will be provided (but I will show the results of a fully licensed analysis).&nbsp; <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo02.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo02.png" alt="Selecting a trial analysis" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Selecting a trial analysis</font></blockquote>
<p>Next, you will be asked where you want to store the analysis file. By default this will go under the Qure folder in My Documents, but be aware that this file can be up to 4GB - so if your C:\ drive is getting skinny, you may want to choose a different location: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo03.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo03.png" alt="Selecting a location for the analysis file" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Selecting a location for the analysis file</font></blockquote>
<p>You will then be asked for the server where your database has been restored. There is an additional warning here that you should not be performing the analysis against a production database (and I strongly recommend you heed this warning). Please make sure this is a *COPY* of your production database and that the server is not a production server. I feel like I'm repeating myself, but it is <b>*extremely important*</b> to avoid running such an analysis against your production environment. The reason is that changes are made to the database in order to validate the recommendations being made will, in fact, improve performance.<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo04.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo04.png" alt="Selecting the server that holds a *copy* of your production database" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Selecting the server that holds a *copy* of your production database</font></blockquote>
<p>Once you connect to a server, Qure will ask you which database(s) you want to analyze. You can select more than one (for a full analysis, you can select three; for a trial analysis, two), but in this case we will just select a single database: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo05.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo05.png" alt="Selecting the database(s) to analyze" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Selecting the database(s) to analyze</font></blockquote>
<p>The next screen asks you for your trace sources. In the base product, you can select any number of trace files, trace tables, or both, but in this custom version of Qure, you go down to Add Trace &gt; Add SQL Sentry Trace: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo06.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo06.png" alt="Adding a SQL Sentry Trace" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Adding a SQL Sentry Trace</font></blockquote>
<p>You will then be asked to point to the SQL Sentry v6 repository, where Qure will analyze the trace data that has already been collected: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo07.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo07.png" alt="Selecting the SQL Sentry v6 repository" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Selecting the SQL Sentry v6 repository</font></blockquote>
<p>On the next screen, there are a couple of options to consider. One that I strongly recommend you select is the option to "Keep all existing indexes." The reason is this: no matter how long you have been collecting trace data or performance metrics, there is always the chance that an index you or software thinks is unnecessary will actually be needed tomorrow. My official advice here is to never drop an index unless you are absolutely sure it is redundant or no longer needed - and never let software do this automatically. Fellow MVP Paul Randal (<a href="http://twitter.com/PaulRandal" target="_blank">twitter</a>) recently <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Beware-of-advice-from-3rd-party-tools-around-indexes.aspx" target="_blank">published a horror story</a> about a tool that recommended dropping "redundant" indexes without knowing the whole story (and failing to recognize the attributes that made the indexes different).
</p>
<p>On the other hand, if you want to see what redundant indexes may be suggested by the tool, it is safe to leave this option unchecked. (Since it knows the workload may not represent a full business cycle, Qure Workload Optimizer will not, in fact, recommend dropping indexes based on use or lack of use - it will only recommend dropping duplicate, redundant, hypothetical or disabled indexes. The "Keep all existing indexes" checkbox here dictates whether redundant indexes are considered - all others will still recommend to be dropped.) When you need to be careful is when you get to the point of applying the recommendations, that you review that involve dropping indexes, and be sure that you want to accept those individual changes (you can easily reject any single recommendation).
<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo09.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo09.png" alt="Analysis settings screen" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Analysis settings screen</font></blockquote>
<p>The next screen is just a summary; you can click the Start Analysis button to get things going:<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo10.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo10.png" alt="Summary / Start Analysis screen" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Summary / Start Analysis screen</font></blockquote>
<p>You can watch the process as it analyzes the server, database(s) and individual objects, and comes up with recommendations: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo11.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo11.png" alt="Generating recommendations..." border="0" height="384" width="516"></a><br><font color="#999999" size="1">Generating recommendations...</font></blockquote>
<p>You will also see it perform a banchmark analysis, testing the performance before and after the recommendations are applied (don't worry, these changes are reverted):
</p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo12.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo12.png" alt="Benchmarking..." border="0" height="384" width="516"></a><br><font color="#999999" size="1">Benchmarking...</font></blockquote>
<p>Once finished, you will arrive at a success dialog:
</p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo13.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo13.png" alt="Summary / View Report screen" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Summary / View Report screen</font></blockquote>
<p>When you click "View Report," you will be shown a screen which summarizes the recommendations. From here you can get a very quick view of the top batch improvements and how the improvements are measured (duration, I/O, CPU, or some combination):
</p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo14.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo14.png" alt="Top Improved Batches" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Top Improved Batches</font></blockquote>
<p>
If you scroll down on that same dialog, you can expand the "Recommendation Summary" to see a high-level view of what types of recommendations are being made, and what kind of impact they will have. Note that not all recommendations are deemed "applicable" - those that are applicable can be applied with minimal risk to behavior, and through scripts generated by Qure Workload Optimizer. The remaining recommendations are provided for guidance and will not be applied automatically - they should still be reviewed, as we'll see on upcoming screens.<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo15.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo15.png" alt="Recommendation Summary" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Recommendation Summary</font></blockquote>
<p>If you switch to the Batches tab, you can see exactly how the recommended changes will affect each batch in terms of the overall workload - be it duration, physical or logical reads, writes, or CPU. You can sort here to focus on the batches with improvements in your area(s) of largest concern, for example if your system is very I/O-bound, you may want to focus on the changes with the greatest improvements in I/O, so sort by the physical reads column. Note that you may see cases where some attributes were affected negatively (e.g. physical reads went up), but overall duration went down. You can select individual or multiple batches here, or even select all to see the total impact of all recommended changes.<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo16c.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo16c.png" alt="Optimization Result - Performance" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Optimization Result - Performance</font></blockquote>
<p>Next, you can move to the Recommendations tab. Here you can review all of the possible changes, and indicate which you want to test by highlighting them and clicking "Accept." Note that the following screen shot shows several recommendations that require manual rewrites of batches; you can't apply these directly to the database, since these were ad hoc queries submitted to SQL Server. But it can give you a good idea about how to improve the code you're sending that way... the example I've pointed out is actually part of my "<a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/16/bad-habits-to-kick-mishandling-date-range-queries.aspx" target="_blank">Mishandling Date Range Queries</a>" set of bad T-SQL habits to kick - applying a function to a column in a search predicate, preventing the use of an index.<br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo17.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo17.png" alt="Recommendations - Script Review" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Recommendations - Script Review</font></blockquote>
<p>You can change the filters on the left to highlight specific recommendations; once you have chosen which recommendations to accept, you can move to the Optimize tab, which will guide you through applying the changes (again, only to a <b>*copy*</b> of your production database). When you are happy with the changes you are about to apply, press the "Start Optimization" button:
</p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo19.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo19.png" alt="Optimize screen" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Optimize screen</font></blockquote>
<p>This will start the "Apply Recommendations Wizard" - which again has sensible warnings about not applying these changes to production databases: <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo20.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo20.png" alt="Apply Recommendations Wizard" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Apply Recommendations Wizard</font></blockquote>
<p>You will be asked again for the connection details of the copy / test database, and then you can choose "Start Applying": <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo21.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo21.png" alt="Select *copy* of production database to affect" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Select *copy* of production database to affect</font></blockquote>
<p>When finished, you will see the following dialog (but don't forget that there are several changes Qure Workload Optimizer recommended but couldn't make automatically, such as changes to batches that are issued ad hoc or from applications): <br></p>
<blockquote style="padding-left:25px;"><a href="http://bertrandaaron.files.wordpress.com/2011/04/qo22.png" target="_blank"><img src="http://bertrandaaron.files.wordpress.com/2011/04/qo22.png" alt="Success dialog" border="0" height="384" width="516"></a><br><font color="#999999" size="1">Success dialog</font></blockquote>
<p>Now you can test your changes in your test or QA server(s) and deem whether they are satisfactory for migration to your production environment. You can watch the newly changed database(s) on the test / QA server with SQL Sentry v6, run applicable workloads against the test server, and you should find a dramatic improvement in performance.<br></p>
<p>Once again, as a reminder, please be sure to thoroughly test changes suggested by any person or piece of software, especially in cases where the whole story may not be known - for example, if your collection has not covered a complete business cycle, or if you have filtered out a large number of individual events. A suggestion can only be as good as the information it's based on.<br></p>
<p>So if you are looking for a reliable and effective way to improve performance of your applications, you should absolutely consider taking Qure + SQL Sentry for a test drive! The software will be available for download soon. In the meantime, if you're not already using SQL Sentry, you can register for a trial download at <a href="http://www.sqlsentry.net/download-trial/trial.asp" title="http://www.sqlsentry.net/download-trial/trial.asp" target="_blank">http://www.sqlsentry.net/download-trial/trial.asp</a>.<br></p>
<p>&nbsp; <br></p>