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

冷暖自知 提交于 2019-11-28 19:44:58
malenkiy_scot

If you do not find a plugin that does it automatically, here's an idea of what you can do:

  • Install Node Label Parameter plugin
  • Add SLAVE parameter to your jobs
  • Restrict jobs to run on ${SLAVE}
  • Add a trigger job that will do the following:

    • Analyze load distribution via a System Groovy Script and decide on which node to start next build.
    • Dispatch the build on that node with Parametertized Trigger plugin by assigning appropriate value to SLAVE parameter.

In order to analyze load distribution you need to install Groovy plugin and familiarize yourself with Jenkins Main Module API. Here are some useful initial pointers.

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.

If your build machines cannot comfortably handle more than 1 build, why configure them with 12 executors? If that is indeed the case, you should reduce the number of executors to 1. My Jenkins has 30 slaves, each with 1 executor.

You may also use the Throttle Concurrent Builds plugin to restrict how many instances of a job can run in parallel on the same node

I have two labels -- one for small tasks and one for big tasks. I have one executor for the big task and 4 for the small tasks. This does balance things a little.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!