Azure Webjobs: One Job with several Functions, or

2019-04-05 09:50发布

How do I decide between creating several WebJobs with 1 function each and bundling several functions into one or only a few WebJobs? Thanks

1条回答
干净又极端
2楼-- · 2019-04-05 10:37

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.

查看更多
登录 后发表回答