{"id":1154,"date":"2007-10-11T00:06:51","date_gmt":"2007-10-11T00:06:51","guid":{"rendered":"\/blogs\/paul\/post\/SQL-Server-2008-Performance-boost-for-Database-Mirroring.aspx"},"modified":"2017-04-13T09:52:07","modified_gmt":"2017-04-13T16:52:07","slug":"sql-server-2008-performance-boost-for-database-mirroring","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/","title":{"rendered":"SQL Server 2008: Performance boost for Database Mirroring"},"content":{"rendered":"<p><FONT face=Verdana><FONT size=2><br \/>\n<P>As I mentioned in a previous post, one of the new features for database mirroring in SQL Server 2008 is log stream compression. There&#8217;s a good explanation of what this is (along with some example workloads and performance graphs)&nbsp;on the <a href=\"http:\/\/blogs.msdn.com\/b\/sqlcat\/\">SQL Customer Advisory Team blog<\/a>&nbsp;so I&#8217;m not going to duplicate all that here.<\/P><br \/>\n<P>Basically, the way mirroring works is by shipping all the transaction log from the principal to the mirror, and then replaying the log records on the mirror database. Network bandwidth can be a bottleneck for mirrored databases where the rate of transaction log generation is high enough to saturate the network. On synchronously mirrored databases (where a transaction cannot commit&nbsp;on the principal until all the transaction log for it has been hardened in the log of the mirror database), this can even lead to workload throughput degradation.<\/P><br \/>\n<P>Log compression is a way to alleviate this problem. SS2008 Books Online states that compression rates of <U><EM>at least<\/EM><\/U> 12.5% are achieved &#8211; obviously the compression ratio could be much higher than that and&nbsp;is dependant on what&#8217;s being compressed &#8211; i.e. the data that is being processed by the application. One of the tests they did for the post above shows a 5x compression ratio &#8211; that&#8217;s pretty good.<\/P><br \/>\n<P>The downside of this is that compression is not free &#8211; extra CPU must be used.&nbsp;The&nbsp;obvious CPU load increases comes from having to&nbsp;compress the transaction log on the principal and then decompress it again on the mirror before hardening it in the log. The non-obvious increase will come because the principal and mirror should end up being able to process more transactions\/second, which means more CPU is needed.<\/P><br \/>\n<P>This extra CPU could be a problem for some systems that are already pegged in terms of CPU load, and so they may actually see a drop in performance when log stream compression is enabled. Now, it&#8217;s on by default when you upgrade to SS2008 but there is a way to turn it off. The blog post above divulges that there is a trace flag, 1462, that turns off log stream compression and effectively reverts the behavior back to SS2005.<\/P><br \/>\n<P>Apart from the obvious benefits of this feature for systems that can afford the extra CPU, I&#8217;m excited because it may allow more mirrored databases to perform effective database maintenance &#8211; in the form of fragmentation control and index maintenance. When database mirroring is enabled, the database has to be running in the full recovery mode. This means that operations such as index rebuilds are fully logged &#8211; that&#8217;s a lot of extra log being generated if you&#8217;re used to switching to bulk-logged recovery mode to perform index operations. Of course, this isn&#8217;t an issue for <EM>reorganizing<\/EM> an index (with <FONT face=\"Courier New\">ALTER INDEX &#8230; REORGANIZE<\/FONT><FONT face=Verdana>) as this has been fully logged (and has to be that way because of how it works) since I wrote <\/FONT>the old <FONT face=\"Courier New\">DBCC INDEXDEFRAG<\/FONT> for SS2000.<\/P><br \/>\n<P>Anyway, for some customers the fact that these two operations are fully logged means that running them produces so much additional log that, in conjunction with the log from the workload itself, the network becomes a bottleneck for mirroring and it slows down both the maintenance and reduces the workload throughput. The addition of log stream compression means that for these systems, the log may be compressed enough so that the network is no longer a bottleneck and more regular fragmentation control can take place. This in turn will increase workload throughput as well &#8211; a double benefit!<\/P><\/FONT><\/FONT><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I mentioned in a previous post, one of the new features for database mirroring in SQL Server 2008 is log stream compression. There&#8217;s a good explanation of what this is (along with some example workloads and performance graphs)&nbsp;on the SQL Customer Advisory Team blog&nbsp;so I&#8217;m not going to duplicate all that here. Basically, the [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,35,66,86,96,98],"tags":[],"class_list":["post-1154","post","type-post","status-publish","format-standard","hentry","category-database-mirroring","category-disaster-recovery","category-performance-tuning","category-sql-server-2008","category-trace-flags","category-transaction-log"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"As I mentioned in a previous post, one of the new features for database mirroring in SQL Server 2008 is log stream compression. There&#8217;s a good explanation of what this is (along with some example workloads and performance graphs)&nbsp;on the SQL Customer Advisory Team blog&nbsp;so I&#8217;m not going to duplicate all that here. Basically, the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2007-10-11T00:06:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T16:52:07+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/\",\"name\":\"SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2007-10-11T00:06:51+00:00\",\"dateModified\":\"2017-04-13T16:52:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server 2008: Performance boost for Database Mirroring\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal","og_description":"As I mentioned in a previous post, one of the new features for database mirroring in SQL Server 2008 is log stream compression. There&#8217;s a good explanation of what this is (along with some example workloads and performance graphs)&nbsp;on the SQL Customer Advisory Team blog&nbsp;so I&#8217;m not going to duplicate all that here. Basically, the [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/","og_site_name":"Paul S. Randal","article_published_time":"2007-10-11T00:06:51+00:00","article_modified_time":"2017-04-13T16:52:07+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/","name":"SQL Server 2008: Performance boost for Database Mirroring - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2007-10-11T00:06:51+00:00","dateModified":"2017-04-13T16:52:07+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/sql-server-2008-performance-boost-for-database-mirroring\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"SQL Server 2008: Performance boost for Database Mirroring"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=1154"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1154\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}