Azure Cloud Service (Web Role) scaling and warm up

azure

I'm playing around with the auto-scale feature of Windows Azure and a cloud service / web role.

I have run some loading tests and it seems to work. My problem is that when a new instance is activated a lot of requests are returning time outs and so on. This is because my app needs to warm up with a couple of requests before it can handle any load.

Are there any way of solving this?

Best Answer

This is a duplicate of the following question: https://stackoverflow.com/questions/26779337/azure-cloud-service-scaled-in-web-site-web-role-instance-recieves-requests-b

In short, what you need to do is to implement WebRole.OnStart(), and do your own warmup there. This way, the Azure load balancer won't direct traffic to your server until warmup has completed.