How are the webjobs distributed across VMs in Azure App service?

Vighnesh Nayak S 1 Reputation point
2022-11-11T11:11:32.93+00:00

There are 10 VMs in Isolated tier and there are 10 deployment slots. I've 10 continuous webjobs one per each slot running in singleton mode. Can I expect webjobs to be distributed across VMs in 1:1 ratio i.e, 1 webjob per VM? Or is the distribution of webjobs done randomly? Could someone please explain how webjobs are assigned to VM?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,880 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,026 Reputation points Microsoft Employee Moderator
    2022-11-14T21:19:24.533+00:00

    @Vighnesh Nayak S , Apologies for the delayed response from over the weekend.

    To provide more clarify on how it works on Azure WebApp - w/ WebJobs, Scale instances, Slots and Singleton.

    -By default, WebJobs scale with their associated Azure Web Apps instance.
    If a continuous job is set as singleton (set to =true), it'll run only on a single instance opposed to running on all instances.

    “WebJobs content” is swapped.
    “WebJobs schedulers” aren’t swapped across swap slots.

    Checkout the doc: Which settings are swapped?

    -Also, each slot is in itself a regular Azure Web App, it will have its own app settings, connection string, WebJob and any other configuration.

    If you have multiple deployment slots for an app, all deployment slots also run on the same VM instances. Example- If you enable diagnostic logs, perform backups, or run WebJobs, they also use CPU cycles and memory on these VM instances.

    • Furthermore, to prevent WebJobs from running on the staging slot you may add an app setting called WEBJOBS_STOPPED and set it to 1.
      Ensure that the app setting is sticky to the slot otherwise it'll propagate to the production slot.

    WebJobs#configuration-settings


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.