Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to open sockets when scaling down Azure web app?

We have a scenario where we use multiple Web apps in Azure, when scaling up I understand Azure is simply starting more Web processes and as such allows for connections to multiple servers, there's a broadcast system in place for the synchronization. The issue is, what happens to an open socket if we manually or automatically scales down? Say we have 5 servers which each have an open web socket, and we scale down to 1, what will happen to the 4 sockets that were connected to the servers that are being removed?

As a side note, if they stick and keep up until the socket is disconnected to the client, will Azure bill me for that time?

If they don't stick, it's only a matter of making sure the client reconnects properly.

By what I've seen so far, it seems to stick, but that might just be a grace period while it's scaling down so I'd rather be on the sure here with an answer from someone who actually knows.

like image 479
Crypth Avatar asked Nov 26 '22 15:11

Crypth


1 Answers

From another thread a few years ago it was the newest instance that is removed (most of the time) but I cannot find anything about it waiting for the connections to drop. Which instances are stopped when I scale my Azure role down?

There is however a management API that you can access to scale down (delete) specific cloud service roles.

The Delete Role Instances operation deletes multiple role instances from a deployment in a cloud service.

POST Request

https://management.core.windows.net/<subscription-id>/services/hostedservices/<cloudservice-name>/deployments/<deployment-name>/roleinstances/

Using this you can monitor which instances you want to remove and send the delete command programmatically. That way you could wait for the users to cleanly disconnect from the instance before deleting it.

Reference to the Microsoft API doc for this: https://msdn.microsoft.com/library/azure/dn469418.aspx

like image 185
greg_diesel Avatar answered Dec 04 '22 08:12

greg_diesel