Azure Webjobs: One Job with several Functions, or several Jobs with 1 function each?

前端 未结 1 661
谎友^
谎友^ 2021-02-19 17:10

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条回答
  •  一整个雨季
    2021-02-19 17:22

    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.

    0 讨论(0)
提交回复
热议问题