Question regarding database mirroring modes and the witness
Solved Email & Outlook
BA
Barry Allen
February 21, 2018
2 replies
6,090 views
Reviewed by moderators

Tasked with adding a standby for one important database and mirroring fits our edition and comfort level. The modes and the witness concept need untangling before I commit.

Synchronous versus asynchronous, when does the witness matter and what does each choice cost?

Accepted Answer
Verified by Edwin J. Hoffer, Database Specialist ยท Reviewed February 2018

Untangling in one pass, costs attached, then the placement note this feature always deserves.

High safety, the synchronous mode: every transaction commits on the principal only after the mirror hardens it too, so the mirror is never behind and failover loses nothing. The cost is latency, each commit waits a network round trip, which between servers in one datacenter is small and between cities is felt by every write. High performance, the asynchronous mode: the principal commits without waiting, the mirror applies the stream as it arrives, writes stay fast and the price is a failover that can lose the tail of recent transactions plus the fact that failover is manual by nature in this mode.

The witness matters in exactly one combination: high safety plus a witness server gives automatic failover, the witness being the tiebreaker that lets the mirror promote itself when the principal dies, avoiding the split brain of both servers deciding they lead. Without a witness, high safety still protects every transaction but a human runs the failover. The witness can be any edition including Express, wants placement where it sees both partners through a network path that fails independently of them and two rules keep it honest: never on the same host as a partner and never load it with other duties that take it down at the wrong moment.

For one important database inside one datacenter, high safety with a witness is the usual right answer, automatic failover with zero loss at a latency cost the local network makes negligible. Across a WAN, high performance protects performance while you accept manual failover with possible tail loss or high safety without a witness if losing nothing outranks fast writes. The placement note as always: mirroring is deprecated in favor of Availability Groups since 2012, entirely functional where edition and simplicity argue for it, but new designs owe the AG comparison a look before settling, the mirroring endpoint thread linked alongside covers the connectivity troubleshooting either way.

Same datacenter, so high safety with an Express witness on the monitoring box it turns out we already had. Failover tested by pulling the principal's network cable, promoted in seconds, nothing lost. AG comparison documented for the eventual redesign.