There are 3 ways to deploy a new function via web job:
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?
I'm interested in how it works, guidance, best practices, and performance impact of these 3 options.
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.
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.
Triggered – Runs only when triggered manually or on a schedule.
Incorrect: WebJobs can be created as standalone executables or scripts.
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 :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With