Follow SQLMaster on Twitter

SQL Server 2005 Database Mirroring choosing optimum value for auto-failover timeout?

Published 12 May 08 02:25 AM | SQL Master 

Choosing a better plan to reduce outage to your database application is a beginner to provide High Availability to your application, irrespective to database or server. You may be aware that SQL Server 2005 version provides the database mirroring which is an advantage to avoid the costs and pre-requisite for Clustering, as it comes when you think about High Availability.

So when you setup the Database Mirroring the partners within this session will be Principal, Mirror and witness, just to talk about witness instance requirement that it should be used only when you  intend to use high-safety mode with automatic failover. In high-performance mode, for which a witness is never required, why and all subject I will cover within another blog post J.

For the subject purpose assume only HIGH SAFETY mode is used where you have an option of choosing Automatic failover mode within the database mirroring sessions having witness aside for quorum purpose. As it is one of the best implementation I choose high-safety mode with automatic failover as database is synchronized, if the principal database becomes unavailable, an automatic failover occurs. During this action the mirror server to take over the role of principal server and bring its copy of the database online as the principal database, like-to-like with 'no (virtually)' data-loss. I believe this is one of the best practice to provide the database be synchronized prevents data loss during failover, because every transaction committed on the principal database is also committed on the mirror database.

So think about how the automatic failver should take into affect, as a part of role switch, the amount of time that database mirroring will be out of service depends on the type of role switching and the cause of the role switch. The technical documentation for SQL Server refers that:

  • For automatic failover, two factors contribute to the time service is interrupted: the time required for the mirror server to recognize that the principal server instance has failed, that is error detection, plus the time required to fail over the database, that is failover time.

  • For a forced-service operation, though a failure has occurred, detecting and responding to the failure depends on human responsiveness. However, estimating the potential interruption of service is limited to estimating the time for the mirror server to switch roles after the forced service command is issued.  

This is where the communication between Principal and Mirror with a Witness instance plays important role, which is a default timeout value of 10 secionds. That means if any of the partners are not ping-able for 10 seconds it can throw a timeout message and the database can failover. At the end of the day you should consider the real-problem wide of failover and not with any other errors from the operating system level that can cause failures such as, Network errors or I/O errors or Process (memory/drivers) errors, etc. So take advantage of causing such an auto-failover of default timeout value, you can make changes by configuring the partner timeout value as shown in the following T-SQL statement:

Use Master;

ALTER DATABASE [Database_Name] Set Partner TIMEOUT [Number_of_Seconds] ;

So here comes the big question what would be optimum value to set, the answer is it depends on your application method to control the committed transactions, where keeping the minimum set of transactions to commit for better availability & performance. Within a scenario of highly-transactional application such as stock exchange trading application, I setup with 25 seconds as the instance (witness) must receive a ping on that connection within the time-out period defined by the mirroring time-out value, plus the time required to send one more ping. Receiving a ping during the time-out period indicates that the connection is still open and that the server instances are communicating over it. On receiving a ping, a server instance resets its time-out counter on that connection.

Just to cover up the difference between running asynchronous & synchronous sessions, where the asynchronous will have default time-out value of 10 seconds that cannot be changed and within synchronous sessions, you can control the time-out period as mentioned above. But always make sure you have tested the failover methods and transaction checking within your environment before taking my word, another best practice.

 

 

 

Comments

# Other SQL Server Blogs around the Web said on May 12, 2008 3:38 AM:

Choosing a better plan to reduce outage to your database application is a beginner to provide High Availability

# High Availability (SSQA.net) : SQL Server 2005 Database Mirroring choosing optimum value for auto-failover timeout? said on May 12, 2008 4:19 AM:

PingBack from http://sqlserver-qa.net/blogs/ha/archive/2008/05/12/sql-server-2005-database-mirroring-choosing-optimum-value-for-auto-failover-timeout.aspx

# Forex Back Testing Software said on September 19, 2008 9:30 AM:

check out AAPL. will it get support at current price levels ( 172)? major trend will be breached soon if Mac Expo 08′ and earning on january 18th do not give investors reasons to keep charging the stock up. If you look at any other tech stock right now

# http://www.4xmini.com said on September 20, 2008 5:56 AM:

To make Forex Market even more unique to traders, it is an over the counter market which operates throughout a network of computers where individuals, banks and corporations trade currencies from one another. This and the fact that it is a market open

# foreign currency mutual funds said on September 23, 2008 10:17 AM:

Menu Forex Strategies (2) Live Forex Data (2) Legal (3) About Forex (4) Recent Articles Risk Disclosure---------- Laquerre and QQE Trading Strategy---------- Laguerre RSI Trade Set Up---------- Facts About Forex----------

# forex demo software said on September 23, 2008 2:21 PM:

You can do what my dad still does to this day: slice the squash in half around its equator, boil (or steam or microwave) until the flesh is soft enough to scoop out the pips easily, add a knob of butter in each hollow, mash the flesh inside the skin and

# Forex Trading System said on October 28, 2008 3:17 PM:

You do not have to be a professional to earn profits from this trade because the automated forex trading systems take care of all the work for you. Automated trading through managed accounts, the...

# Safety Signs and Notices said on July 5, 2009 3:22 PM:

GLASS AWARENESS STICKERS. ENABLES YOU TO COMPLY WITH REGULATION 14 THE WORKPLACE HEALTH ADN SAFETY ACT 1992, THAT EVERY WINDOW OR TRANSLUCENT SURFACE MUST BE MARKED

# Predictive Dialer Software said on July 6, 2009 1:08 AM:

This webinar replay even has more than a little excitement in it. At about 50 minutes, we lost the voice phone bridge. You can either skip forward about three minutes, at which time we restored the audio or you can enjoy the drama in my voice as I switch

# credit restoration said on September 26, 2009 11:11 PM:

This is a great site, I only wish I had found it sooner.

# Twitter Trackbacks for High Availability (SSQA.net) : SQL Server 2005 Database Mirroring choosing optimum value for auto-failover timeout? [sqlserver-qa.net] on Topsy.com said on April 26, 2010 9:11 PM:

PingBack from http://topsy.com/trackback?utm_source=pingback&utm_campaign=L2&url=http://sqlserver-qa.net/blogs/ha/archive/2008/05/12/sql-server-2005-database-mirroring-choosing-optimum-value-for-auto-failover-timeout.aspx

Anonymous comments are disabled

About SQL Master

**__________________________________** SQL Server MVP, Sr. DBA & industry expert. - Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.

Search

Go

This Blog

«May 2008»
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Business Continuity

Syndication