jenkinsci / azure-slave-plugin

18 stars 41 forks source link

Only 1 slave provisioned per template #27

Open alexschwantes opened 8 years ago

alexschwantes commented 8 years ago

It is a little unclear what the expected outcome is, however the actual behaviour differs from what I expected.

Given that I have the max Virtual machines set to a high number ie 5, when I start a job that is restricted to run on a configured Azure template label, the Azure plugin provisions a new slave. However if I start two jobs that are restricted to run on the same Azure template label, one job will start on the provisioned slave and the other one will just queue. What I expected to happen was that a new slave is provisioned to cater for the second job as the number of virtual machines in the subscription is less than my configured max.

Edit: After further investigation I did manage to get a second slave to be provisioned but it is not clear why.

With the azure slaves configured to only run 1 job at a time.

It seems that the workload value is the crucial part in initiating a new slave to be provisioned. But why this isn't triggered when there is a queued job or from the Buildflow plugin I'm not sure.

I want to avoid queuing jobs, when there is room for more azure slaves to be provisioned.

alexschwantes commented 8 years ago

So digging in a bit more I found some information on this over at https://cloudbees.zendesk.com/hc/en-us/articles/204690520-Why-do-slaves-show-as-suspended-while-jobs-wait-in-the-queue- which points to the internal Jenkins provisioning strategy used to decide if a new node should be provisioned or not. It seems to get greater control over this they created their own NodeProvisioner Strategy.

Further, https://github.com/jenkinsci/mesos-plugin#over-provisioning-flags explains that Jenkins spawns slaves conservatively, and provides the following flags that can be overridden during Jenkins Startup to spawn an executor for each build in queue immediately without waiting: -Dhudson.slaves.NodeProvisioner.MARGIN=50 -Dhudson.slaves.NodeProvisioner.MARGIN0=0.85

Doing this so far has produced better results for my needs. It would be nicer however if this could be configured from within Jenkings rather than editing java opts...,