1

we have a deployed VMSS to run an Agent Pool inside our environment.

In Azure DevOps we have set Standby = 0 as the Agents are not required the whole time.

When now a single pipeline starts, we see a "Scaling out" from 0 to 4, I would expect from 0 to 1

enter image description here

Overprovisioning on the VMSS is Not enabled

Why does it spin up so many instances?

Thanks in advance

Joerg

Jörg Lang
  • 171
  • 1
  • 1
  • 8

2 Answers2

0

Try set "Maximum number of virtual machines in the scale set" to "1".

enter image description here

You could find this setting in Azure DevOps -> Agent pools -> choose your target VMSS agent pool -> Settings

Kim Xu-MSFT
  • 1,819
  • 1
  • 2
  • 4
  • But that will not help if multiple pipelines has to run in parallel... – Jörg Lang Dec 02 '22 at 07:52
  • If your single pipeline has only one job, it should be "0" to "1". If your single pipeline has 4 jobs (No dependency, self-hosted parallel jobs >4), it will be "0" to "4", because the 4 jobs run in parallel. – Kim Xu-MSFT Dec 02 '22 at 08:03
  • The pipline has 4 stages with in total 6 jobs. Dependencys are only defined explicit in two stages, which have each two jobs inside. so do I need to define the dependency between the stages explicity too, even if the are processed in right order? – Jörg Lang Dec 02 '22 at 08:44
  • Yes, your understanding is right. For this single pipeline, you could do a test by defining the dependency between the stages explicitly too. Then check the "Scaling out" number. – Kim Xu-MSFT Dec 02 '22 at 08:50
  • I have done so and it's still doing `0 to 4` – Jörg Lang Dec 02 '22 at 08:54
  • I have this same issue. I set my maximum number of virtual machines to 100, as our pipeline can get under heavy load. I ran a test which queued up 4 jobs in the agent pool, and it immediately started 35 machines. When I reduced the maximum to 30, it scaled up to 13 machines when 4 jobs were added to the queue. – James Thurley Jan 19 '23 at 15:50
0

The additional instances may be caused by the Default scale-in policy, see https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-scale-in-policy?WT.mc_id=Portal-Microsoft_Azure_Monitoring#default-scale-in-policy

By default, Virtual Machine Scale Set applies this policy to determine which instance(s) will be scaled in. With the Default policy, VMs are selected for scale-in in the following order:

* Balance virtual machines across availability zones (if the scale set is deployed in zonal configuration)
* Balance virtual machines across fault domains (best effort)
* Delete virtual machine with the highest instance ID

Users do not need to specify a scale-in policy if they just want the default ordering to be followed.

Note that balancing across availability zones or fault domains does not move instances across availability zones or fault domains. The balancing is achieved through deletion of virtual machines from the unbalanced availability zones or fault domains until the distribution of virtual machines becomes balanced.

crasp
  • 743
  • 14
  • 22