向外扩展时限制天蓝色webjob的实例数 [英] Limit number of instances of an azure webjob when scaling out

查看:99
本文介绍了向外扩展时限制天蓝色webjob的实例数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们的应用程序服务计划扩展时,我想限制特定Webjob的实例数量.

I would like to limit the number of instances of a particular webjob when our app service plan scales out.

尽管我知道

Whilst I am aware of the possibility of having a singleton instance I cannot find any docs to help if we want to limit the number of instances to n where n is a number greater than 1 but less than the total number of instances in the app service plan. For example our app service plan could scale out to be running 4 instances but only a maximum of 2 of them would be allowed to be running a given webjob.

(当然)我知道我们可以有两个具有不同扩展规则的应用程序服务计划,但我真的很想在现有计划中处理该计划.

I am (of course) aware that we could just have 2 app service plans with different scaling rules but I'd really just like to handle this within the existing plan if possible.

背景:

我们在应用程序服务计划中运行的webapps和webjobs设置为随着CPU使用率增加到一定阈值以上而自动扩展.

We have webapps and webjobs running in an app service plan set to auto-scale out as CPU usage increases above a certain threshold.

我们的Web作业执行后台"处理任务,这些任务不是特别时间敏感的,但可能会占用大量CPU.如果队列中有很多消息,则这些Web作业会消耗几​​乎所有可用的CPU资源,并导致大规模的横向扩展.如果我们使用单例Web作业,则横向扩展仅会添加一个额外的实例,即使在高峰时间也是如此,其他所有内容仍然保持响应状态.除非网络作业花费太长时间来清除队列,否则这将是很好的.我们真的很想能够更好地平衡这一点,以允许几个实例运行webjobs,从而允许稍快的处理时间,但要避免将cpu密集型webjob添加到第三个实例.

Our webjobs do 'background' processing tasks that are not particularly time sensitive but can be quite cpu intensive. If a lot of messages are in the queue these webjobs can consume almost all the available cpu resource and cause a massive scale-out. If we use a singleton webjob then the scale out only adds a single extra instance even at peak times and everything else still stays responsive. This would be fine execept the webjobs are taking too long to clear the queues. We'd really like to be able to balance this better to allow a couple of instances running the webjobs to allow slightly faster processing time but to avoid it adding the cpu-intensive webjob to the 3rd instance.

推荐答案

Azure Web App支持按应用程序缩放.但它仅适用于Premium SKU App Service计划.每个应用程序缩放可独立于托管应用程序的服务计划来缩放应用程序.这样,一个应用程序服务计划可以扩展到10个实例,但是一个应用程序可以设置为仅使用5个实例.

Azure Web App supports per app scaling. But it is available only for Premium SKU App Service plans. Per app scaling scales an app independently from the App Service plan that hosts it. This way, an App Service plan can be scaled to 10 instances, but an app can be set to use only five.

对于您的问题,您可以创建一个新的Web应用程序来承载WebJob.

For your issue, you could create a new web app to host your WebJob.

有关如何按应用缩放使用,请点击以下链接.

For how to use per app scaling, link below is for your reference.

在Azure上进行高密度托管应用服务

这篇关于向外扩展时限制天蓝色webjob的实例数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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