<?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>Argenis Fernandez : WAN, Replication</title><link>http://sqlblog.com/blogs/argenis_fernandez/archive/tags/WAN/Replication/default.aspx</link><description>Tags: WAN, Replication</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Transactional Replication and WAN links</title><link>http://sqlblog.com/blogs/argenis_fernandez/archive/2011/05/31/transactional-replication-and-wan-links.aspx</link><pubDate>Tue, 31 May 2011 15:39:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:35990</guid><dc:creator>Argenis</dc:creator><slash:comments>12</slash:comments><comments>http://sqlblog.com/blogs/argenis_fernandez/comments/35990.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/argenis_fernandez/commentrss.aspx?PostID=35990</wfw:commentRss><description>&lt;p&gt;We&amp;nbsp;recently worked on a&amp;nbsp;transactional replication setup that involved a very active VLDB and&amp;nbsp;a subscriber being located on a different datacenter. What made it even more interesting is that the WAN link was not&amp;nbsp;particularly fast. In this post, I would like to mention a few of the challenges we faced while and how we got past them, in the hopes that&amp;nbsp;our experience can help you in your future endeavours.&lt;/p&gt;&lt;p&gt;&lt;u&gt;The Problem with Slow Distribution Servers&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;If your distribution server is slow, your replication performance will tank. You will get behind on transactions and might not ever catch up. In our scenario we had a distribution server that was outdated. The server was running Windows Server 2003 and SQL Server 2005. In our case, this was the biggest issue. After we moved to a new distribution server that was running Windows Server 2008 R2 and SQL Server 2008 R2, our performance increased greatly. One of the biggest benefits in moving to Windows Server 2008 R2 is the set of enhacements made to the TCP/IP stack - particularly send/receive TCP windows. For more information, see this &lt;a title="New Networking Features in Windows Server 2008 and Windows Vista" href="http://technet.microsoft.com/en-us/library/bb726965.aspx"&gt;article on Technet&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Careful with WAN Accelerators&lt;/u&gt;&lt;/p&gt;&lt;p&gt;While WAN accelerators can be fantastic in a myriad of scenarios, in our testing we noticed that the&amp;nbsp;device wasn't really optimizing replication traffic - and it was actually causing latency. With the help of our Networking team, we made sure that traffic from the distributor to the subscriber was&amp;nbsp;skipped by the WAN accelerator. Obviously, your mileage will vary - so test accordingly.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Use Pull Subscriptions&lt;/u&gt;&lt;/p&gt;&lt;p&gt;Our initial setup was done using a Push subscription. This was a&amp;nbsp;big mistake. While Push subscriptions are easier to setup and maintain, their performance across WAN links is plain dismal. The MSDN team at Microsoft put out a great &lt;a title="Geo-Replication Performance Gains with Microsoft SQL Server 2008 Running on Windows Server 2008" href="http://msdn.microsoft.com/en-us/library/dd263442(v=sql.100).aspx"&gt;White Paper on Geo-Replication Performance&lt;/a&gt; which is, in my opinion, required reading for replication to other datacenters. We saw huge performance gains when we switched to Pull. Orders of magnitude faster. Put simply - never use Push subscriptions across WAN links.&lt;/p&gt;&lt;p&gt;One of the design decisions made in our scenario that I would like to point out: we intentionally kept the distribution database near the publisher (i.e., on the same datacenter) - the reason behind this is simple: if your level of confidence in your WAN link isn't that high, the concern becomes the Log Reader agent and getting the Transaction Log to clear reliably and constantly. &lt;/p&gt;&lt;p&gt;&lt;u&gt;Initialize the Subscriber from a Backup&lt;/u&gt;&lt;/p&gt;&lt;p&gt;With a WAN link and high latency involved, &lt;a title="How to: Initialize a Transactional Subscription from a Backup (Replication Transact-SQL Programming)" href="http://msdn.microsoft.com/en-us/library/ms147834.aspx"&gt;initialization of the subscriber from a backup&lt;/a&gt; is your best bet. We saved ourselves a lot of headaches by doing it. Creating and transferring a snapshot of a VLDB is out of the picture when you're concerned with WAN latency.&amp;nbsp;In our scenario, the publisher was running SQL Server 2005 and backups were being taken using LiteSpeed. We transferred&amp;nbsp;the most recent&amp;nbsp;full backup to the remote datacenter using robocopy (could have used FTP also) plus the latest differential taken after changing the properties of the publication to allow initialization from backup. Restored at the subscriber using LiteSpeed tools, and then&amp;nbsp;used the &lt;a title="Quest LiteSpeed Extractor" href="https://support.quest.com/search/SolutionDetail.aspx?id=SOL22045"&gt;Extractor utility&lt;/a&gt; to create native-format backup files to initialize&amp;nbsp;from backup. This is because you cannot initialize from a LiteSpeed backup, as SQL needs to read LSN information from the backup file and it uses a system stored procedure for that purpose. Here are some tips: you only need the first backup file created by Extractor to initialize. Also, you don't have to initialize with a differential backup - you can use a T-Log backup just as well.&lt;/p&gt;&lt;p&gt;&amp;nbsp;Here is a good post on &lt;a title="Deep Dive on Initialize from Backup for Transactional Replication" href="http://blogs.msdn.com/b/repltalk/archive/2010/03/16/deep-dive-on-initialize-from-backup-for-transactional-replication.aspx"&gt;Initialization from Backup at ReplTalk&lt;/a&gt; that might be helpful if you run into issues.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Other Optimizations&lt;/u&gt;&lt;/p&gt;&lt;p&gt;There are other replication features that help reduce the amount of commands sent across to the subscriber. Namely:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a title="Publishing Stored Procedure Execution in Transactional Replication" href="http://msdn.microsoft.com/en-us/library/ms152754.aspx"&gt;Publishing&amp;nbsp;the execution of stored procedures&lt;/a&gt; as opposed to replicating each operation performed by the stored procedure.&lt;/li&gt;&lt;li&gt;Leveraging &lt;a title="Navigating SQL Replication SubscriptionStreams setting" href="http://blogs.msdn.com/b/repltalk/archive/2010/03/01/navigating-sql-replication-subscriptionstreams-setting.aspx"&gt;Subscription Streams&lt;/a&gt; - again, your mileage might vary. Test to see if it makes sense for you.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Happy Publishin'!&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=35990" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/argenis_fernandez/archive/tags/WAN/default.aspx">WAN</category><category domain="http://sqlblog.com/blogs/argenis_fernandez/archive/tags/Backups/default.aspx">Backups</category><category domain="http://sqlblog.com/blogs/argenis_fernandez/archive/tags/Replication/default.aspx">Replication</category></item></channel></rss>