Azure Webjobs:一个具有多个功能的作业,还是每个具有1个功能的作业? [英] Azure Webjobs: One Job with several Functions, or several Jobs with 1 function each?

查看:63
本文介绍了Azure Webjobs:一个具有多个功能的作业,还是每个具有1个功能的作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在创建每个具有1个功能的多个Web作业与将几个功能绑定到一个或仅几个WebJob之间进行选择? 谢谢

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

推荐答案

您的问题没有直接答案.抱歉.

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:我唯一能给出的指导原则是:如果函数真的很小(几行代码),则将它们放在同一个webjob中可能会更容易,因为维护多个程序集会产生相当大的开销.

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.

这篇关于Azure Webjobs:一个具有多个功能的作业,还是每个具有1个功能的作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆