Why is Azure not dispatching HTTP requests on one of my two instances?

前端 未结 2 983
刺人心
刺人心 2021-01-26 10:38

I have an Azure web role with two instances. Both instances are \"ready\" - running okay.

On my desktop I have four instances of the same program running simultaneously

相关标签:
2条回答
  • 2021-01-26 10:41

    This is likely from the Load Balancer optimizing request routes because all of the requests are coming from the same IP. While it often looks like it, the LB in Azure is not a true dumb Round Robin.

    If you just didn't expect this, but the server is handling the load, then you are ok. You could even turn off the second instance until your metrics show the server is busy (saving you money).

    If you need to be able to load balance from the same IP, then I would look at using a queue perhaps. Although that would be unusual for a web request (versus some backend processing).

    0 讨论(0)
  • 2021-01-26 10:47

    Looks like this behavior is due to IIS "keep alive" (<system.webServer><httpProtocol allowKeepAlive="true">. Because of "keep alive" once a client has been served by an instance it gets stuck with that instance.

    Disabling "keep alive" removes that and requests now get to all instances more or less randomly. MSDN says disabling "keep alive" may reduce performance but for the sake of testing concurrent operation it would be okay.

    0 讨论(0)
提交回复
热议问题