Azure cloud service - Does VIP swap cause OnStop() to be invoked?
Asked Answered
G

2

6

I have an Azure cloud service with a web and a worker role. When an Azure cloud service is stopped, the OnStop() method is invoked.

On a VIP swap, does it call the same OnStop() method on the outgoing service deployment as soon as the VIP swap is requested? http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.onstop.aspx

Also, what is the order of events during the VIP swap? Presumably, the worker OnStart() method of the new deployment is run at some point, but is this before the OnStop() of the outgoing deployment? I am trying to understand whether the two worker role versions (incoming and outgoing deployment) will be running concurrently, or whether there will be a short gap in worker role service.

Glarum answered 11/3, 2013 at 9:7 Comment(1)
Gaurav and Sharptooth covered the OnStop part (basically, OnStop only happens when your role is stopped - and a VIP swap does not initiate a stop). I would like to comment on your secondary question: "I am trying to understand whether the two worker role versions (incoming and outgoing deployment) will be running concurrently, or whether there will be a short gap in worker role service." The short answer is that there should not be a gap where NOTHING is listening, but OLD and NEW code can still be executing concurrently because OLD may already be processing requests when NEW swaps in.Trinatrinal
L
7

To the best of my knowledge, when you perform VIP swap changes happen at the router/firewall level and not at the cloud service level. Your cloud service keeps on running and OnStop() event is not fired. As mentioned in the documentation here: http://msdn.microsoft.com/en-us/library/windowsazure/hh386336.aspx

When the service is promoted to production, the VIP and URL that were assigned to the production environment are assigned to the deployment that is currently in the staging environment, thus “promoting” the service to production. The VIP and URL assigned to the staging environment are assigned to the deployment that was in the production environment.

Lanark answered 11/3, 2013 at 9:16 Comment(0)
S
1

No events are fired during the "VIP swap". We've added tracing for just all kind of events and entry points and definitely from the role code it looks like nothing happens during the "VIP swap".

You service will not be interrupted during the swap. Just new requests will start coming to the new deployment. The older and the newer deployments run in parallel until you stop the older (now staging) one. Your application should be able to handle this scenario and not break anything.

Stentor answered 11/3, 2013 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.