How can I modify the Load Balancing behavior Jenkins uses to control slaves?

Jay Spang picture Jay Spang · Jun 14, 2012 · Viewed 14.7k times · Source

We use Jenkins for our CI build system. We also use 'concurrent builds' so that Jenkins will build each change independently. This means we often have 5 or 6 builds of the same job running simultaneously. To accommodate this, we have 4 slaves each with 12 executors.

The problem is that Jenkins doesn't really 'load balance' among its slaves. It tries to build a job on the same slave that it previously built on (presumably to reduce the time syncing from source control). This is a problem because Jenkins will build all 6 instances of our build on the same slave (or more likely between 2 slaves). One build machine gets bogged down and runs very slowly while the rest of them sit idle.

How do I configure the load balancing behavior of Jenkins, and how it controls its slaves?

Answer

bstick12 picture bstick12 · Jun 4, 2013

We were facing a similar issue. So I've put together a plugin that changes the Load Balancer in Jenkins to select a node that currently has the least load - https://wiki.jenkins-ci.org/display/JENKINS/Least+Load+Plugin

Any feedback is appreciated.