jenkinsjenkins-agent

How to split load between master and slave


I have setup a slave. For a job that executes a shell script, I configured to run either on the slave and on the master. If I launch 2 instances of the same job, I observe that the job is run only by the master, and the 2nd instance waits to the 1st one to finish, and it will be run also by the master.

I expect master and slave to work simultaneously.

Why is the slave always idle?

Is there a way to prioritize one slave?

UPDATE: In my use case, a job uses the database for destructive tests, so is not good for reliability to have more than one instance of the same job in a node. Each node has a copy of the database.


Solution

  • This is an improvement on Wim answer:

    Go to the job configuration page and check "Execute concurrent builds if necessary". This will allow multiple instances of your job to execute at the same time.

    Next, use the Throttle Concurrent Builds Plug-in.

    In this way, only one execution per node is allowed, and the load is balanced between different nodes.

    In this way, a node doesn't loose the ability to run simultaneously several unrelated jobs.