<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'Best Practices', 'SQL Server 2005', and 'Performance'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Best+Practices,SQL+Server+2005,Performance&amp;orTags=0</link><description>Search results matching tags 'Best Practices', 'SQL Server 2005', and 'Performance'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>A Rose By Any Other Name</title><link>http://sqlblog.com/blogs/linchi_shea/archive/2007/11/20/a-rose-by-any-other-name.aspx</link><pubDate>Tue, 20 Nov 2007 20:04:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:3442</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;P&gt;Regardless of the DBMS make or model, the transaction throughput curve of a database system is often shaped like a trapezoid. As the load level goes up initially, so does the transaction throughput. As the load level continues to go up, the transaction throughput will reach a plateau. After the load level is cranked up still further, the transaction throughput will inevitably start to drop and may eventually come to a&amp;nbsp; halt.&lt;/P&gt;
&lt;P&gt;With respect to the throughput drop under severe load, two questions are interesting: (1) what is the cause of the drop? and (2) what can we do to delay the drop until an even higher load level?&lt;/P&gt;
&lt;P&gt;The answers are of course dependent on the nature of the workload, the system configurations, and a host of other factors. &lt;/P&gt;
&lt;P&gt;So rather than trying to address the questions in general, let's look at one specific type of tests I often perform, which is to stress the processors, memory, and their interconnect of a server with a SQL Server read-only workload that effectively caches all the data pages in memory. In other words, this workload takes the disk I/Os out of the equation.&lt;/P&gt;
&lt;P&gt;As expected and with no exception, I would see the transaction throughput start to drop--sometimes rather dramatically--as I increase the load level beyond saturation. When this may happen often correlates nicely with a dramatic increase in waits on &lt;I&gt;Thread-safe memory objects waits&lt;/I&gt; under &lt;I&gt;SQLServer:Wait Statistics&lt;/I&gt;. Unfortunately, this wait counter is documented with a rather useless tautology in that the explanation more or less repeats what the name already suggests without adding useful information. (BTW, the explanation is "Statistics for processes waiting on thread-safe memory allocators"). So,&amp;nbsp; from looking at the wait stats, I can't really tell what wait or waits are killing the transaction throughput.&lt;/P&gt;
&lt;P&gt;The point I want to illustrate, however, is the dramatic impact of a change to the workload--a change that merely gives the stored procedures different names.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Original workload:&lt;/B&gt; The database calls of the workload calls are even distributed between two stored procedures, spOrderStatus and spStockLevel. &lt;/P&gt;
&lt;P&gt;&lt;B&gt;Modified workload&lt;/B&gt;: In the same database, I created 100 stored procedures: spOrderStatus_1 through spOrderStatus_100, that are identical to spOrderStatus except the names. Similarly, I created another 100 stored procedures: spStockLevel_1 through spStockLevel_100, that are identical to spStockLevel except the names. I then modified the original workload to distribute the database calls evenly among spOrderStatus_1 through spOrderStatus_100 and spStockLevel_1 through spStockLevel_100.&lt;/P&gt;
&lt;P&gt;With the modified workload, the same database was able to sustain the peak throughput for significantly higher load level (i.e. more users). The following chart summarizes the throughput behavior between the original workload and the modified workload on the test server:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://sqlblog.com/blogs/linchi_shea/attachment/3442.ashx"&gt; &lt;/P&gt;
&lt;P&gt;I didn't specifically test how many identical but differently named stored procedures I had to create to see the impact on the transaction throughput. 100 for each stored procedure was picked randomly. &lt;/P&gt;
&lt;P&gt;Note that this is a known technique and is used in some of the published SQL Server TPC-C tests. For instance, in the best &lt;A href="http://www.tpc.org/tpcc/results/tpcc_result_detail.asp?id=105112801"&gt;SQL Server TPC-C results obtained on HP Superdome&lt;/A&gt;, 32 New_Order stored procedures are created with 32 different names but identical code inside. Stored procedures with different names but identical code are also created for several other transactions.&lt;/P&gt;
&lt;P&gt;So, a rose by a different name may just smell better.&lt;/P&gt;</description></item><item><title>Performance Impact: The Potential Cost of Read_Committed_Snapshot</title><link>http://sqlblog.com/blogs/linchi_shea/archive/2007/10/04/performance-impact-the-potential-cost-of-read-committed-snapshot.aspx</link><pubDate>Fri, 05 Oct 2007 03:49:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:2883</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;P&gt;In response to my previous blog post--&lt;A href="http://sqlblog.com/blogs/linchi_shea/archive/2007/10/01/performance-impact-setting-a-database-to-read-only.aspx"&gt;Performance Impact: Setting a Database to Read Only&lt;/A&gt;, Shailesh Khanal mentioned that he observed significant performance degradation from&amp;nbsp;READ COMMITTED SNAPSHOT OFF to ON for a read-only workload. This&amp;nbsp;is counter intuitive since there is nothing in the version store if only SELECT statements are running, and the overhead of turning READ COMMITTED SNAPSHOT ON without maintaining any versions shouldn't be that high.&lt;/P&gt;
&lt;P&gt;So I decided to conduct some tests myself with a different read-only workload on SQL Server 2005 SP2 (9.00.3042) Enterprise Edition. The read-only workload was the same as that described in&amp;nbsp;the previous blog post--&lt;A href="http://sqlblog.com/blogs/linchi_shea/archive/2007/10/01/performance-impact-setting-a-database-to-read-only.aspx"&gt;Performance Impact: Setting a Database to Read Only&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;My results were mixed. On one hand, I confirmed Shailesh Khanal's observation that turning READ COMMITTED SNAPSHOT ON caused significant performance degradation. It's interesting to note that performance degradation was all observed on 64-bit 16-way machines. On the other hand, I didn't always observe heavy performance penalty when turning READ COMMITTED SNAPSHOT ON. On a 32-bit 4-way machine, I didn't see any degradation at all. The following two charts summarize&amp;nbsp;my results:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://sqlblog.com/blogs/linchi_shea/attachment/2883.ashx"&gt; &lt;/P&gt;
&lt;P&gt;In Fig 1, the performance penalty of READ_COMMITTED_SNAPSHOT&amp;nbsp;for a read-only workload was astounding. Just by turning READ_COMMITTED_SNAPSHOT OFF, the transaction throughput gained a whopping ~60%. This was observed in repeated test runs, and on two different platforms. The common characteristics of these two platforms included: (1) the SQL Server 2005 instances were both x64 running on Windows 2003 x64, and (2) the servers&amp;nbsp;both had 16 cores.&lt;/P&gt;
&lt;P&gt;That's bad news. But there&amp;nbsp;was good news. On a different platform, repeating the same test led to very different results as summarized in Fig 2 above. If there is any difference between the two lines in Fig 2, turning READ_COMMITTED_SNAPSHOT ON appears to have produced slightly better throughput, though the difference should probably be considered insignificant and within the margin of error. This test platform was 32-bit SQL Server 2005 running on 32-bit Windows 2003, and the server had 4 cores.&lt;/P&gt;
&lt;P&gt;Now, I don't know the test environment that Shailesh Khanal used&amp;nbsp;to obtain his results. But from my own tests,&amp;nbsp;I'd venture a conjecture that the performance difference could be attributed to the difference between 64-bit and 32-bit, not the hardware difference between 4 cores and 16 cores. And I'd further venture to suggest that the performance degradation from READ_COMMITTED_SNAPSHOT OFF to ON in the case of 64-bit and read-only workload was most likely due to a bug because the degradation was simply too large to be a feature or by design.&lt;/P&gt;
&lt;P&gt;So is there any practical significance to all this?&lt;/P&gt;
&lt;P&gt;Clearly, you need to use READ_COMMITTED_SNAPSHOT with caution in performance tuning. Best practice recommends that you consider using it if contention is costing you throughput. For read-only workloads, there is no reader/writer contention for READ_COMMITTED_SNAPSHOT to help avoid, and there is no statement-level data consistency problem for it to prevent.&lt;/P&gt;
&lt;P&gt;The other lesson is that you really can't assume anything, even if it intuitively makes sense. You should always confirm it through testing, if possible.&lt;/P&gt;
&lt;P&gt;Finally, there could be a scenario where you have a read/write workload, and READ_COMMITTED_SNAPSHOT improves its performance by resolving your reader/write contention problem, but at the same time degrades the performance of its read-only queries. Overall, you may or may not see a net gain. Again, you'll have to run tests to be sure one way or another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description></item></channel></rss>