Will an Azure Web job run on multiple instances?

driis picture driis · Feb 11, 2014 · Viewed 9.8k times · Source

I am planning to deploy a website to Azure, that will utilize Web Jobs.

If the site is scaled up to run on multiple instances, should I expect the job to be started on all the instances as well (running concurrently), or can I expect there to only be one instance of the job running at a time ? Can this be configured in Azure ?

Answer

David Ebbo picture David Ebbo · Feb 11, 2014

I assume you are using Continuous WebJobs and not Manual/Scheduled. In that case, it will run on all the instances at once. For this to happen correctly, you need to be running in Standard mode, and have the Always On setting enabled.

If you don't want it to run on all instances, you can set it to be in 'singleton' mode by creating a file called settings.job alongside your WebJob files. It should contain:

{ "is_singleton": true }

Note that when using the Kudu Process Explorer UI, you are connecting to a single instance, and won't see processes from other instances. Instead, use the Processes UI built in the Preview Portal (https://portal.azure.com/), which shows processes in all instances.