I have implemented an azure cloud service (recipesavants.cloudapp.net) with 2 instances (both small) and anytime I go to the URI it takes forever (usally 30+ seconds) for the 1st page to render.
I am thinking that this is because the instance is spinning up from a sleep or inactive state, is this correct?
To alleviate this - I have created a worker role that pings the URI every minute using the following code:
using (var client = new HttpClient())
{
// New code:
client.BaseAddress = new Uri("http://brewsavants.cloudapp.net");
HttpResponseMessage response = await client.GetAsync("");
client.BaseAddress = new Uri("http://recipesavants.cloudapp.net");
response = await client.GetAsync("");
client.BaseAddress = new Uri("http://recipesavantsapi.azurewebsites.net/api/ping");
response = await client.GetAsync("");
}
But, it still seems like after 20 minutes or so - the instances go to sleep. Is there another work around? I really need these instances to be highly available, and fast.