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

问题描述

我有一个 Azure 应用服务,我使用应用服务计划在其中创建了 5 个实例横向扩展选项.现在我不确定 Azure 如何在这些实例之间平衡请求?我没有看到任何负载均衡器.

I have one Azure App Service in which I have created 5 instances using App Service PlanScale 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 设置为粘性".您可以在应用服务的应用程序设置中找到设置:

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 负载平衡如何横向扩展应用服务计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 22:21