Testing Azure VMs Autoscale with the Load balancer

In the previous article, I'm set up a Virtual machine Scale set (VMSS) behind a load balancer with a manually adjust number of VMs: Migration on-premise ERP(Legacy) to Azure Part 3 : Config VMs scale sets

In this article. I will be going to make 3 scenarios to test how a load balancer working.  and try to config VM auto-scale feature by Simulate Application server running IIS in a scale set  by trigger HTTPS request to the application server for creating Sales order record in Azure SQL





Environment provisioning 

1. Create Virtual Machin Scale set with two scenario

    - Manual scale set 2 VMs

    - Auto Scale Set  2 => 4 VMs


-Size of VM

    using small  VMs size (B1s) because I want to see the movement of  CPU and Ram during high workload.

    - Configuration  Loadbalancer

    Loadbalancer will allocate requests from clients to VMs that are behind in the backend pool. In this case backend pools are VM scale sets.





2. Create Azure SQL for Database Ties 



3. Create a simple application using C# hosting on the IIS  connected Azure SQL




    Because my ERP application server requires more dependency and takes time to install. So I going to create a Web API using C# to simulate the Sales Order logic functionality. another article for Create Net Core web API using C#: Create and Publish NETCore web-API running on Azure container Instance


4. Use Postman to check the connection from Client to App and database tier working find before initial huge request test. if the transaction is complete the server will return the order number.






Testing Stage

    I  simulate sales order requests from clients by using loading.io 


by condition 

How does my server perform when 100 users connect every 1 second over  minutes Duration?


Test Result 

3.1 Single Instants


Average Response Time 6361  /Response Counts success 1581 / Timeout 8



Sales transaction has been inserting to SQL only on application server VM.






3.2  Two Instants  manual scale set





Average Response Time 3008  / Response Counts success  13,141 Zero Timeout 


Sales transaction has been inserting into SQL from two VMs Instant







3.3 Configulation autoscale    4 Instants



The initial of  VMs is 2 and can increase to 4 Instants maximum. By increase 1 Instant if CPU threshold an over 50%

when you config rule in azure if  Duration of rule less than 5 minutes. You will see a warning message as follow 

"Setting a duration less than 5 minutes may generate transient metric spikes that lead to unexpected scaling actions. For best results, the duration should be set at least to 5 minutes"



After 5 Min The VM status is starting because the VM may need some time provisioning process.So this round only 2 VMs working for Request the resource not different from 3.2





So I wait till all 4 Instant are started then trigger the request



Average Response Time 1822  / Response Counts success  19,472 /  Timeout 82 


Sales transaction has been inserting into SQL from four VMs Instant







So the conclusion from my Lab  The VM scale set is working for elastic requests by config autoscale. it still a good idea for traditional software that requests running on VMs

But you may need to consider the Autoscale rule conditional.





Next Article I will testing about container-based applications on Azure.

Performance testing on Azure VMs, App Services Scalable, and Container Instances  (Part1)


Thanks for you visit my blog