Azure Web作业-同一Web作业中的多个功能和/或同一Web应用程序中的多个Web作业对性能的影响? [英] Azure Web Job - Performance impact of multiple functions in the same web job and/or multiple web jobs in the same web app?

查看:144
本文介绍了Azure Web作业-同一Web作业中的多个功能和/或同一Web应用程序中的多个Web作业对性能的影响?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有3种通过Web作业部署新功能的方法:

There are 3 ways to deploy a new function via web job:

  1. 创建一个新的Web应用程序,并部署包含该功能的Web作业.
  2. 向现有的Web作业中添加新功能(因此,现在您在一个Web作业中具有多个功能).
  3. 将新的Web作业添加到Web应用程序中(因此现在您在同一个Web应用程序中具有多个Web作业).

同一Web应用程序上的所有Web作业和Web作业功能都托管在同一VM上,因此这三者的实质影响是相同的.但我想知道有什么区别.

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.

对于确定如何向云解决方案中添加新的Web作业功能有什么指导?

What guidance is there for deciding how I should add a new web job function to my cloud solution?

  1. 具有网络工作的新网络应用
  2. 或现有网络应用程序中的新网络作业以及其他网络作业
  3. 或现有Web作业中的新功能以及其他功能.

我对这三个选项的工作方式,指导,最佳做法以及对性能的影响感兴趣.

I'm interested in how it works, guidance, best practices, and performance impact of these 3 options.

推荐答案

这是一个很难回答的问题,我将尽力为您提供一些线索. 您应该记住以下几点:

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:

  • 性能:如果将每个都放在同一作业中,则每次调用您的函数之一时,作业主机都会创建一个新线程.如果在同一进程中出现线程过多,可能会降低性能.我的选择是限制在同一进程中运行的线程数.如果您用Google搜索"多线程与多处理",就会发现一些很好的答案.无论如何,没有通用的指导原则,您应该使用配置文件工具来帮助您确定哪种情况下最好的解决方案.

  • 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.

崩溃:假设您在同一作业中有2个功能.如果一个函数崩溃,则可能会使整个作业崩溃.因此,您可能需要创建单独的作业来隔离需要保持弹性并始终运行的功能.

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.

配置:同一Web应用程序中的多个作业可以共享配置(应用程序设置").取决于您如何管理配置(从门户网站或使用app.config),您可能需要为没有相同配置的作业创建单独的Web应用程序.

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.

部署:在Web应用程序中部署Web作业时,它将导致Web应用程序重新启动.如果您有一个网站或必须继续运行的其他工作,则可能需要创建一个单独的Web应用程序,以便特定组件的新部署不会影响其他组件的可用性.

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.

缩放":Webjobs将在您应用服务的所有实例上运行.您可以将特定作业或特定功能指定为单例.这也是您要记住的事情.

"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.

否则,您可能会对 Azure函数感兴趣.它使用动态应用程序服务计划,该计划会自动扩展,并且只有在功能运行时才需要付费.每个功能都是独立的,因此您完全不必担心:-)

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 :-)

这篇关于Azure Web作业-同一Web作业中的多个功能和/或同一Web应用程序中的多个Web作业对性能的影响?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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