Is it wise to host webjob on separate service plan from web apps?

Piyush Bhatt 6 Reputation points
2021-03-31T17:34:02.777+00:00

For a webjob that is heavily using CPU and Memory, we are considering to host it in separate service plan so that it does not eat from the cpu/memory allocated to the web-app.

Is this wise thing to do and do you have any technical reasons for not doing this?

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

2 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 15,606 Reputation points
    2021-04-01T23:35:40.29+00:00

    Hi @Piyush Bhatt ,

    There is not a big technical difference with hosting your web job and web app in different App Service Plan but it will cost you more. WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use WebJobs.

    You can always scale up your web jobs to multiple instances if they are consuming high CPU/memory. Keep in mind that WebJobs are tied directly to App Service instances, they automatically scale with the number of App Service instances you have deployed.

    If you do not want your WebJob to scale up with your instance count, you can utilize the is_singleton property in the settings.job file and set the value to true. This will ensure the Web App only runs a single instance of your WebJob. The Singleton attribute ensures that only one instance of a function runs, even when there are multiple instances of the host web app. It does this by using distributed locking. Please read this documentation to learn more about the Singleton attribute.

    Hope that helps.

    Best,
    Grace

    0 comments No comments

  2. Piyush Bhatt 6 Reputation points
    2021-04-02T01:07:45.3+00:00

    Thank you for your answer. Yes we do use singleton - but I was still thinking whether if anyone has hosted them totally separate and ran into any issue or not.

    0 comments No comments