How do I decide between creating several WebJobs with 1 function each and bundling several functions into one or only a few WebJobs? Thanks
-
1I think that it mostly depends on your use case. The main question would be if you want to trigger the functions independent of each other, each using its own schedule. Do you have a specific scenario? – Horizon_Net Nov 06 '14 at 18:45
-
Say that I have 2 functions. Each read from a unique blob container, and write to a unique queue. They are totally independent from each other. Should I put them in the same WebJob project using JobHost? Or separate projects? – Nestor Nov 06 '14 at 19:02
-
1If you develop them independent from each other (with the possibility that different teams can work on one of them) I would go with two separate projects. If they are independent of each other, but are living in the same domain of functionality (for example one messaging system with different message workers), you can put them into one project. That's mostly a question of personal preference and if they are logically in the same domain. – Horizon_Net Nov 06 '14 at 19:17
1 Answers
There is no straight answer to your question. Sorry.
Usually you group functions by workflow or role. For example if you have a workflow that contains a function that resizes an image, then a function that applies a watermark and another one that replicates the images then it makes sense to put all the functions together because they are related. You are more likely to change all of them when you modify the flow.
On the other hand, you might argue that functions should be separated. Unless you change the input/output, there is no reason to modify more than one function. However, if you need to change more than one function, you will end up editing more projects.
As you see, both arguments have pros/cons and there is really no right answer.
Try to experiment and see which approach works better for your solution.
PS: The only guideline that I can give is: if the functions are really small (a few lines of code), probably it is easier to put them in the same webjob because there is quite some overhead in maintaining multiple assemblies.

- 28,177
- 5
- 87
- 103