Bobcares

Session Timeout for Availability Group Replica – How to modify

by | Mar 9, 2022

Session Timeout for Availability Group Replica can be easily modified with this easy guide by the experts at Bobcares.

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.

Let’s take a look at how our Support Team is ready to help customers with session timeout for availability group replica.

How to modify Session Timeout for Availability Group Replica

Many of our customers come across an alwayson connection timeout on availability group replicas. Fortunately, our Support Team has come up with a solution for the issue.

The alwayson session timeout or Always on Connection timeout has to be the same and also configured as per the Microsoft recommendation. Furthermore, the SQL Server Session timeout for availability replica is the time an availability replica waits for a ping response from the connected replica before the connection is considered to have failed.

Session Timeout for Availability Group Replica

Moreover, the connection timeout setting in AOAG affects the secondary replica as well as the corresponding primary replica. Interestingly, every secondary replica has a different session timeout value between the replica and its primary replica.

The default value of the session timeout configuration is 10 seconds. According to our Support Techs, we have to keep this value at 10 seconds or more in order to prevent any missing pings or false failure alerts.

How to Change Session Timeout for Availability Replica

Our Support Techs recommend modifying or changing the connection or session timeout value if we keep getting connection timeout errors frequently. Especially, if we keep getting SQL errors 35206 or 35201. The Support Team has come up with three different ways to modify session timeout in alwayson availability group:

  • SQL Server Management Studio (SSMS)
  • T-SQL statement
  • PowerShell

How to change Alwayson Connection Timeout using SQL Server Management Studio

  1. First, launch SSMS and connect to the primary replica.
  2. Then, click the plus sign next to Always on High Availability node and then select Availability Groups node.
  3. After that, identify and select the availability group for which we want to configure the connection timeout for the availability replica.
  4. Next, choose the availability replica for which we want to change the value and right-click it, and select Properties.
  5. Then, we change the value in the Session timeout in the Availability Replica Properties dialog box on the properties page. Our Support Team recommends keeping the value at ten or as per our specification.

How to modify Alwayson Connection Timeout using T-SQL Statement

  1. First, launch the SSMS and connect to the primary replica.
  2. Then open a New Query window and execute the following ALTER AVAILABILITY GROUP statement:
    ALTER AVAILABILITY GROUP group_name
    
    MODIFY REPLICA ON 'instance_name' WITH ( SESSION_TIMEOUT =seconds )

    Our Support Team would like to point out that we have to replace group_name and instance_name with the availability group name and the Make sure to replace group_name with the availability group name, instance_name with the secondary replica name respectively.

How to modify Alwayson Connection Timeout using PowerShell

  1. First, change the directory to the server instance hosting the primary replica.
  2. Next, use the SessionTimeout parameter and the Set-SqlAvailabilityReplica cmdlet to change the value of the session-timeout period on a specified availability replica. For instance:
    Set-SqlAvailabilityReplica -SessionTimeout 15 `   
    -Path SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MyAg\AvailabilityReplicas\MyReplica

[Looking for a solution to another query? We are just a click away.]

Conclusion

In brief, our skilled Support Engineers at Bobcares demonstrated how to modify session timeout for availability group replica.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.