SQL Server Always On: Minimal Synchronous-Commit Cross-Subnet Design
Zero-data-loss failover across subnets with SQL Server Always On synchronous commit, plus when to redesign.
06 Jan 2026, 05:43 UTC

The problem and the usable answer
You need committed transactions to survive a node failure without data loss, applications to fail over automatically within seconds, and a readable secondary for reporting. The database tier spans subnets, so a simple virtual IP on one subnet will not reach clients everywhere.
The practical answer is a two-node Windows Server Failover Cluster (WSFC) running one Always On availability group with synchronous-commit mode on the secondary replica. Synchronous commit means the primary waits for the secondary to harden the transaction log before confirming a commit to the application. Add a third asynchronous replica only if reporting can tolerate replication lag; do not stretch synchronous commit across a high-latency WAN.
Requirements
- Zero data loss for committed transactions on the protected database.
- Automatic failover within seconds after a node or instance failure.
- Readable secondary for reporting workloads.
- Online patching or maintenance without application downtime.
- Client connectivity across subnets through a stable listener name.
Assumptions: SQL Server Enterprise Edition on Windows Server with Active Directory domain membership. Standard Edition, Linux containers, and SQL Server 2019 and earlier have different capabilities and licensing limits. Verify edition-specific behavior in your version before production use.
Smallest suitable design
Two cluster nodes, each running a SQL Server instance. Node A hosts the primary replica; Node B hosts a synchronous-commit secondary with automatic failover. Both replicas belong to the same availability group. A cluster witness provides quorum so a network partition cannot leave both nodes believing they are primary.
If the reporting requirement is strict, add Node C as an asynchronous-commit secondary configured for read-only connections. The asynchronous replica is readable, but committed transactions on the primary are not guaranteed to be visible there immediately. Making the reporting replica synchronous would force every primary commit to wait for that node, which is usually unacceptable for reporting latency.
Trust and data boundaries
- Replicas normally require Active Directory domain membership, or certificate-mirrored endpoints in a workgroup or multi-domain scenario.
- The SQL Server service account needs CONTROL SERVER and connect rights on the database mirroring endpoint.
- Logins, SQL Agent jobs, linked servers, and database permissions do not replicate automatically. Synchronize them separately, including the server-level logins used by application connections.
- Secondary backup access requires explicit login mapping on the secondary instance.
Example: endpoint, availability group, and listener
Run the following on the node that will host the primary. It requires sysadmin or CONTROL SERVER permission.
-- Create the Always On endpoint. Run on each replica node.
CREATE ENDPOINT [HadrEndpoint]
STATE = STARTED
AS TCP (LISTENER_PORT = 5022)
FOR DATABASE_MIRRORING (
ROLE = ALL,
AUTHENTICATION = WINDOWS,
ENCRYPTION = REQUIRED
);
Create the availability group on the intended primary. Replace placeholders in brackets with your environment values.
CREATE AVAILABILITY GROUP [AG_Orders]
WITH (DB_FAILOVER = ON, AUTOMATED_BACKUP_PREFERENCE = SECONDARY)
FOR DATABASE [Orders]
REPLICA ON
N'SQL-NODE-01.corp.example.com' WITH (
ENDPOINT_URL = N'tcp://SQL-NODE-01.corp.example.com:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = AUTOMATIC,
SECONDARY_ROLE (ALLOW_CONNECTIONS = READ_ONLY)
),
N'SQL-NODE-02.corp.example.com' WITH (
ENDPOINT_URL = N'tcp://SQL-NODE-02.corp.example.com:5022',
AVAILABILITY_MODE = SYNCHRONOUS_COMMIT,
FAILOVER_MODE = AUTOMATIC,
SECONDARY_ROLE (ALLOW_CONNECTIONS = READ_ONLY)
);
Add the listener. In a cross-subnet deployment, the listener typically needs an IP address per subnet or an internal load balancer; a single static IP will not route across subnet boundaries.
ALTER AVAILABILITY GROUP [AG_Orders]
ADD LISTENER N'AG-Orders-Listener' (
WITH IP ( (N'10.0.1.50', N'255.255.255.0') ),
PORT = 1433
);
Expected check: connect to AG-Orders-Listener from an application server in each subnet and run SELECT @@SERVERNAME;. The result should be the current primary node. After failover, the same name should resolve to the new primary, but the application must retry broken connections; the DNS name alone does not reconnect sessions transparently.
Operational checks
Run these on the primary. They require VIEW SERVER STATE.
-- Replica role and synchronization state
SELECT ar.replica_server_name,
ars.role_desc,
ars.synchronization_state_desc,
ars.synchronization_health_desc
FROM sys.dm_hadr_availability_replica_states ars
JOIN sys.availability_replicas ar ON ar.replica_id = ars.replica_id;
-- Send and redo queue depth per database
SELECT dr.database_name,
dr.send_queue_size,
dr.redo_queue_size,
dr.synchronization_state_desc
FROM sys.dm_hadr_database_replica_states dr;
For a healthy synchronous secondary, synchronization_state should be SYNCHRONIZED and send/redo queues should remain near zero under normal load. Review the Windows Server Failover Cluster validation report weekly for network, storage, and quorum health before production cutover.
Failure modes and conditions
- Failed synchronous secondary: primary commits can block until timeout or failover completes. Automatic failover moves the primary role to the surviving node; without a witness or with quorum loss, the cluster may stay offline.
- Network partition: split-brain risk if the cluster lacks a quorum witness. The witness can be a file share, cloud witness, or disk witness.
- Long-running primary transactions: increase log-send latency and extend commit time because the primary waits for log hardening on the synchronous secondary.
- Log full on secondary: if redo falls behind, the primary transaction log cannot truncate, risking log growth on the primary.
When this design should change
- Disaster recovery target is beyond synchronous-commit latency limits, such as a geographically distant site. Switch to asynchronous-commit with manual failover and accept possible data loss.
- Read-scale reporting without automatic failover is the goal. Use a read-scale availability group or asynchronous secondaries without HA intent.
- Licensing is Standard Edition. Basic availability groups support limited automatic failover and do not allow readable secondaries.
Rollback and state changes
Creating or modifying an availability group changes database state. To remove the example group, run on the primary:
ALTER AVAILABILITY GROUP [AG_Orders] REMOVE DATABASE [Orders];
DROP AVAILABILITY GROUP [AG_Orders];
Risk: the secondary database enters a restoring or unsynchronized state, application connection strings break, and re-creating the group requires a full data synchronization or seed. Plan a maintenance window and verify backups before removal.
Practical verification before cutover
- Confirm
sys.fn_hadr_is_primary_replica('Orders')returns 1 on the current primary. - Perform a planned manual failover:
ALTER AVAILABILITY GROUP [AG_Orders] FAILOVER; - Verify clients reconnect through the listener within your recovery time objective.
- Review cluster validation logs and confirm quorum is healthy.
If any check fails, do not cut over to production. Resolve network, endpoint, or quorum issues first.