Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web Job - Performance impact of multiple functions in the same web job and/or multiple web jobs in the same web app?

There are 3 ways to deploy a new function via web job:

  1. Create a new web app, and deploy a web job with the function in it.
  2. Add a new function to an existing web job (so now you have multiple functions in one web job).
  3. Add a new web job to a web app (so now you have multiple web jobs in the same web app).

All web jobs and web job functions that are on the same web app are hosted on the same VM, so maybe the material impact of all 3 is the same. But I wonder what is the difference.

What guidance is there for deciding how I should add a new web job function to my cloud solution?

  1. New web app with web job
  2. or new web job in an existing web app with other web jobs
  3. or a new function in an existing web job with other functions.

I'm interested in how it works, guidance, best practices, and performance impact of these 3 options.

like image 523
richard Avatar asked Oct 26 '16 23:10

richard


People also ask

Which Azure websites feature should you enable for continuously running WebJobs?

If you set the web app that hosts your job to run continuously, run on a schedule, or use event-driven triggers, enable the Always on setting on your web app's Azure Configuration page. The Always on setting helps to make sure that these kinds of WebJobs run reliably.

What is difference between WebJobs and Azure functions?

Summary. Azure Functions offers more developer productivity than Azure App Service WebJobs does. It also offers more options for programming languages, development environments, Azure service integration, and pricing. For most scenarios, it's the best choice.

Which of the following type of Web job will be invoked only when you specifically take action to invoke it?

Triggered – Runs only when triggered manually or on a schedule.

Which of the following is not true about WebJobs?

Incorrect: WebJobs can be created as standalone executables or scripts.


1 Answers

This is a hard question to answer and I try'll to give you some clues. Here is few things that you should keep in mind:

  • performance: If you put every in the same job, the jobhost will create a new thread every time one of your functions is invoked. Having too many threads in the same process can hurts performance. My choice would be to limit the number of threads running in the same process. If you google "Multithreading vs. Multiprocessing", you'll find some great answers about this. Anyway there is no general guideline and you should use a profiling tool to help you deciding what is the best solution in your case.

  • Crash: Let's say you have 2 functions in the same job. If one function crashes, it may crash the whole job. So you may need to create separate jobs to isolate functions that need to be resilient and run all the time.

  • Configuration: Multiple jobs in the same web app can share configuration (App Settings). Depends on how you manage your configuration (from the portal or using app.config) you may need to create separate web app for jobs that do not have the same configuration.

  • Deployment: When you deploy a webjob inside a webapp, it will cause the webapp to restart. If you have a web site or another job that have to keep running, you may need to create a separate web app so that new deployment of a particular component does not impact the availability of the other components.

  • "Scaling": Webjobs will run on all the instances of you app service. You can specify a particular job or a particular function to be a singleton. This is also something that you should keep in mind.

Otherwise you may be interested in Azure Functions. It uses a dynamic app service plan that scales automatically and you only pay when you functions are running. Each function are independent so you don't have to worry at all :-)

like image 55
Thomas Avatar answered Oct 13 '22 23:10

Thomas