0
votes

Ok Azure Experts,

  • I have a task that only needs to run once every week - this is a long running task that can take 2-3 days to run.

  • I have set up a worker role to scale based on a queue. On the day that we want the task to start - we populate the queue (using a Web Job).

  • During the rest of the time, when the queue is empty, I want the worker roles to shut down - but I cannot scale down to 0 instances.

  • Originally, we wanted to do this with a Web Job, but the website shuts down from time to time - abruptly turning off my webjob - is this supposed to happen? Even with Keep-Alive turned on? Also, you cannot stop a triggered Web Job from running - so if we want the process to stop - we need to turn off the Web site - not ideal.

How do I scale my instances down to zero?

* Alternatives solutions are also welcome.

Trying to minimize cost here - why pay for a worker role that isn't doing anything?

1
Hi Simcha, is your WebSite with the WebJob in the Standard Tier and Set to AlwaysOn? If not, your WebSite will shut down in idle mode and boots up when being accessed. Then your WebJob won't run anymore.wuerzelchen

1 Answers

0
votes

It is not possible to scale-down a Worker Role to 0 instances at this time. Even if you STOP the worker role, you're still incurring charges for STOPPED instances.

However, behavior that you're looking for, is possible with Virtual Machines. If you shutdown (STOP & DEALLOCATE) a virtual machine, you're not paying fees for that machine.

Now, the only challenge is to stop/start the VM based on a queue count. I don't recall if Azure portal's native scaling supports scaling down to 0 instances for VMs. However, if you use AzureWatch, you should be able to get this done without any issues. Disclaimer: I am affiliated with AzureWatch.

HTH