Shutting down application that is served behind Azure LB gracefully

Vitalii Stadnyk 1 Reputation point
2021-09-30T00:07:32.837+00:00

Hey, I have a LB set up in Azure that fronts 2 VMs. There is a health probe that determines "health" status of the backend servers and once the VM is reported as unhealthy, all new connections are routed to the only healthy node.

My problem is that the existing TCP connections are still routed to the same node which could be now unhealthy which creates an interruption in service. I have set IIS app pool Rapid-Fail Protection setting to TcpLevel which should terminate all TCP connections when app pool is shut down. However, existing connections are still routed to the server after app pool is stopped. Is there a way to force new tcp connections to be established in this scenario?

Internet Information Services
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
402 questions
{count} votes

1 answer

Sort by: Most helpful
  1. mxg 1 Reputation point
    2022-02-22T08:27:01.787+00:00

    Hi @Vitalii Stadnyk ,

    Did you finally find a solution to get the user routed to a healthy instance in step 3?

    I am facing the same issue with Azure Load Balancer (standard tier). When an application pool goes down, it takes about 10-20 seconds for health probe to mark VM as unhealthy. From this point new connections are routed to another VM in the backend pool. But existing connections are still being routed to the unhealthy instance.

    I have set "Service Unavailable" Response Type for IIS Application Pool to TcpLevel (from HttpLevel) but it makes no difference.

    Here you can see the Azure Load Balancer configuration:
    176745-2022-02-22-09h15-49.png

    Values for Session persistence, Floating IP and Outbound SNAT must be configured this way, due to other restrictions.
    I've tested with different values for TCP reset - turned it on and off. But this makes no difference to reported behavior.

    I believe Session persistence could speed up switching to healthy VM, because user could basically get a new route on every request. But we explicitly want to have session persistence, so user "stays" on a vm - as long as it's healthy.

    0 comments No comments