I have a set of build jobs in jenkins that can run in any one of 3 build nodes. They are all labeled with a common label of "ubuntu_build". Each of the nodes has a number of executors thus allowing some of the builds to execute in parallel on a machine. The setup is running fine and does what it is supposed to but I would like to improve it.
The 3 build nodes have varying performance. The first is twice as fast as the second which is twice as fast as the third. (call them fast_node, regular_node, slow_node)
As I understand the scheduling strategy, the machine that was used last for a given build job will be preferred the next time around. This can sometimes lead to issues when there are not many builds going through and the jobs were last built on slow_node and thus it keeps going there even though fast_node has some executors that could work.
What I would like is a way to say that for any job coming through the queue I would like it to try to find room on fast_node, then regular_node, then finally slow_node. (ie. try to keep using the fastest executor that is available)
Is there anyway to set something like this up?
By default, Jenkins employs the algorithm known as consistent hashing to make this decision. More specifically, it hashes the name of the node, in numbers proportional to the number of available executors, then hashes the job name to create a probe point for the consistent hash.
Nodes are the "machines" on which build agents run. Jenkins monitors each attached node for disk space, free temp space, free swap, clock time/sync and response time. A node is taken offline if any of these values go outside the configured threshold. The Jenkins controller itself runs on a special built-in node.
Use Authorize Project plugin to assign authentication to your builds. Then Just set Computer/Build permissions for you nodes (Can be done in Role Strategy plugin for example) Use Job Restrictions Plugin to restrict access to node via Node properties.
Yes, it will build the job on that single node. Usually we have labels that are generic i.e. multiple nodes use same label name as per their use.
Based upon AltF4_ answer I looked again at the plugins and found The Scored Load Balancer Plugin. It looks like it could do even better than the Least Load Plugin. I am going to give it a try and see how it works out.
I was reading another question similar to this it was suggested there that you can use a plugin called "Least Load Plugin"
Summary
By default Jenkins tries to allocate a jobs to the last node is was executed on. This can result in nodes being left idle while other nodes are overloaded. This plugin overrides the default behavior and assigns jobs to nodes with the least load. The least load is defined as a node that is idle or the one with the most available executors. It is intended to provide the same functionality as the commercial plugin Even Scheduler Plugin.
Here is the link : https://wiki.jenkins-ci.org/display/JENKINS/Least+Load+Plugin
Source question: How can I modify the Load Balancing behavior Jenkins uses to control slaves?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With