question

PiyushBhatt-3879 avatar image
0 Votes"
PiyushBhatt-3879 asked PiyushBhatt-3879 answered

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

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-webapps-webjobs
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered

Hi @PiyushBhatt-3879 ,

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




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PiyushBhatt-3879 avatar image
0 Votes"
PiyushBhatt-3879 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.