Sql-server – Can Availability Groups provide seamless failover (with no query failures)

availability-groupssql serversql-server-2012

I have been testing the Availability Groups feature in SQL Server 2012 and am finding that there is approximately 15 seconds of down time when the primary server fails over to the secondary server. All SQL queries executed during this time are failing until the failover transition is complete.

Is there any way to get this down to 0 seconds and prevent queries from failing during the failover transition?

In other words, is there a way to get any queries running during the failure to be redirected to the primary server instead of failing… and is there any way to get new db connections to immediately connect to the secondary server instead of failing to connect during the failover transition?

I currently have 2 servers set up in the Availability Group.

Best Answer

No, there's no way to do zero-downtime failover with AlwaysOn (or in SQL Server in general, as far as I'm aware). To do that, the SQL Server you're connected to would have to do state transfer to another node mid-query, and since many failovers are unexpected, that's not possible.

However, you can enable "read-only secondaries" in AlwaysOn, and then your readers would have zero-downtime when the primary server fails over - since they're connecting to a secondary copy anyways to do their SELECT queries, they wouldn't even notice the failover. There would still be an interruption for users with a "Write" connection open, but at least some part of your user base would be uninterrupted.