how **cookie based affinity** works on vmss downsizing in Application Gateway

Raghava Sai Akula 361 Reputation points

Hi there,
I was wondering how cookie based affinity in Application Gateway works while downsizing VMSS instance

I am having 2 VMSS instances with IIS installed & has 10+ .NET applications, if my CPU usage goes up by>70% for 5 mins if will spin up new instance(3rd instance) and route the traffic to the newly created one , but suddenly if the CPU percentage comes <50% then it will automatically delete newest instance that is created.
but what if one my request is still active on 3rd(newly created instance ). will my VM(3rd instance)wait for the request to complete or simply shutdown the instance?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,567 questions
Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,007 questions
Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
363 questions
0 comments No comments
{count} votes

Accepted answer
  1. msrini-MSFT 9,271 Reputation points Microsoft Employee


    You can configure the connection draining settings in the HTTP Settings of the Application gateway so the on-going session to the removed instance will exist for the configured time.


    Karthik Srinivas

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,551 Reputation points Microsoft Employee

    Hello @Raghava Sai Akula ,
    Welcome to Microsoft QnA Platform.
    The 3rd VMSS instance will not wait for the request to complete, the instance will be removed when your threshold value is reach (CPU < 50%) for over 5 minutes.
    Hope that clears your query. Let me know if you have any further questions.

    If you find the answer helpful, please accept as answer.

    0 comments No comments