VitaliiStadnyk-9857 avatar image
0 Votes"
VitaliiStadnyk-9857 asked BruceZhang-MSFT commented

Shutting down application that is served behind Azure LB gracefully

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?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VitaliiStadnyk-9857 ,

Why you set Rapid-Fail Protection to TCP level? As IIS said, if set to TCP level, http.sys will reset the connection. So the connection will route to the server again. Rapid-Fail Protection is not to protect or create a new connect when application pool crash. It will stop application pool when the application pool crashes to the set conditions.

0 Votes 0 ·
3.jpg (35.9 KiB)

Hey, thank you for getting back to me. I expect tcp connection to be reset by HTTP.sys when I stop app pool with TcpLevel setting selected.
The issue though is that requests from clients are still routed to "dead" instance during deployment. I am looking for a way in Azure LB to route ALL requests (new and existing) to a healthy instance. Do you know if there is some setting that I am missing for it?

Here is an example of current behavior:
1. User X makes a request to my web application -> it hits LB -> it gets routed to one of 2 alive instances (let's assume it's the first machine in the pool).
2. Deployment of my application starts which stops app pool on the first machine
3. User X makes another request and gets "Service is unavailable" even though second instance of the website is alive on the second server.

I would like to set it up in a way that in step 3 User X is routed to a healthy instance.

0 Votes 0 ·
BruceZhang-MSFT avatar image BruceZhang-MSFT VitaliiStadnyk-9857 ·

Hi @VitaliiStadnyk-9857 ,

I'm not sure how you set load balance because I'm not engineer of Azure. If you set load balance in ARR of IIS, ARR load balancer health test and live traffic test will check whether the resource servers every few seconds. If it detect unhealthy response, then it will mark the corrupted as unhealthy. Then all requests will be routed to other server. You can get this information from this document.

1 Vote 1 ·

0 Answers