SQL Server: connection timeouts in a multi-subnet availability group
Avoid listener connection timeouts with MultiSubnetFailover.
In an Always On availability group spread over several subnets, the listener has one IP address per subnet. A client that tries these addresses one after the other can exceed its connection timeout after a failover.
The usual client-side fix is to add MultiSubnetFailover=True to the connection string, which makes the client try the listener IP addresses in parallel:
Server=tcp:AG1-listener,1433;Database=AppDb;MultiSubnetFailover=True;Integrated Security=SSPI
Notes
- If the client does not support this option, the cluster-side
RegisterAllProvidersIPsetting of the network name resource can be changed andHostRecordTTLlowered. - See the Microsoft documentation on availability group client connectivity ("MultiSubnetFailover").