Azure负载平衡如何扩展App Service计划? [英] How Azure load balances scaled out App Service plan?

本文介绍了Azure负载平衡如何扩展App Service计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Azure App Service,其中已使用App Service Plan创建了5个实例向外扩展选项.现在,我不确定Azure如何在此实例之间平衡请求的负载?我没有看到任何负载平衡器.

I have one Azure App Service in which I have created 5 instances using App Service Plan Scale Out option. Now I am not sure how does Azure load balances requests between this instances? I am not seeing any load balancer for it.

我又怎么知道哪个实例正在处理哪个请求?

Also how can I know that which request is being served by which instance?

推荐答案

负载均衡器是自动创建的,您看不到它.

The load balancer is created automatically and you can't see it.

基本上,它可以将请求随机发送到实例,尽管可以通过ARR Affinity使它粘滞".您可以在App Service的应用程序设置"中找到该设置:

Basically it sends the requests to instances at random, though it can be made "sticky" with ARR Affinity. You can find the setting in the App Service's Application Settings:

如果启用,则负载平衡器会将cookie附加到响应(如果响应尚无响应).这样可以使将来的请求命中相同的实例.当然,如果实例不再存在(例如由于自动缩放),那么它将再次进入随机实例.

If it is on, the load balancer will attach a cookie to responses if they don't already have it. It makes it so that future requests hit the same instance. Though of course if the instance is no longer there (because of auto-scale for example), then it will again go to a random instance.

WEBSITE_INSTANCE_ID 环境变量可以在后端告诉您哪个实例正在处理请求.您可以在此处找到可用变量的列表: https://github.com/projectkudu/kudu/wiki/Azure-runtime-environment

The WEBSITE_INSTANCE_ID environment variable can tell you in the back-end which instance is handling the request. You can find a list of available variables here: https://github.com/projectkudu/kudu/wiki/Azure-runtime-environment

这篇关于Azure负载平衡如何扩展App Service计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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