{"id":18542161,"url":"https://github.com/heremaps/saturate-nodes-plugin","last_synced_at":"2025-06-27T04:33:16.455Z","repository":{"id":71903539,"uuid":"87950169","full_name":"heremaps/saturate-nodes-plugin","owner":"heremaps","description":"A Jenkins plugin which allows to saturate nodes as much as possible","archived":false,"fork":false,"pushed_at":"2017-10-26T19:28:40.000Z","size":15,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-10T11:49:57.234Z","etag":null,"topics":["cloud","cost-optimization","jenkins","load-balancing","plugin"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heremaps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-11T15:26:22.000Z","updated_at":"2024-05-16T20:29:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfbf1b18-6ffb-47df-a51f-7d89ce6320ee","html_url":"https://github.com/heremaps/saturate-nodes-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/heremaps/saturate-nodes-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heremaps%2Fsaturate-nodes-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heremaps%2Fsaturate-nodes-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heremaps%2Fsaturate-nodes-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heremaps%2Fsaturate-nodes-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heremaps","download_url":"https://codeload.github.com/heremaps/saturate-nodes-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heremaps%2Fsaturate-nodes-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262188396,"owners_count":23272341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","cost-optimization","jenkins","load-balancing","plugin"],"created_at":"2024-11-06T20:07:35.761Z","updated_at":"2025-06-27T04:33:16.447Z","avatar_url":"https://github.com/heremaps.png","language":"Java","readme":"# Saturate Nodes Load Balancer Plugin\n\nA Jenkins plugin which allows to saturate nodes as much as possible.\n\nTable of contents\n---\n\n1. [Overview](#overview)\n1. [Building](#building)\n1. [Basic Usage](#basic-usage)\n1. [Authors](#authors)\n1. [License](#license)\n\nOverview\n---\n\nBy default Jenkins uses a consistent hashing algorithm for load balancing: It always tries to execute a job on the same node where it was executed before.\nThis approach has one big disadvantage in case of cloud based CI - it keeps a lot of nodes up and running.\n\nThe Saturate Nodes Load Balancer plugin addresses this issue using a pretty simple algorithm:\n- Select nodes of the specified label.\n- Order node based on the time it was connected to the Jenkins master.\n- Pick-up the available executor.\n\nAs a result it should minimize the number of used nodes.\n\nLet's take a look at an example. Suppose there is only one node:\n- nodeA with 4 executors (e1, e2, e3, e4)\n\nNow you need to run 10 builds from 10 different jobs. To avoid a queue you use some cloud plugin (let's say [EC2 Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Amazon+EC2+Plugin)), which will dynamically spawn more nodes:\n- nodeB with 4 executors (e5, e6, e7, e8)\n- nodeC with 4 executors (e9, e10, e11, e12)\n\nAccording to Jenkins history this would result in something like:\n- nodeA =\u003e j1#1\n- nodeA =\u003e j2#1\n- nodeA =\u003e j3#1\n- nodeA =\u003e j4#1\n- nodeB =\u003e j5#1\n- nodeB =\u003e j6#1\n- nodeB =\u003e j7#1\n- nodeB =\u003e j8#1\n- nodeC =\u003e j9#1\n- nodeC =\u003e j10#1\n\nWhen new builds from some of these jobs will be started, they will get executed on same nodes:\n- nodeA =\u003e j1#2\n- nodeB =\u003e j5#2\n- nodeB =\u003e j8#2\n- nodeC =\u003e j9#2\n\nAs a result, the cloud plugin will not be able to shutdown any node, because it none is idle.\n\nWith the Saturate Nodes Load Balancer Plugin this would simply look like:\n- nodeA =\u003e j1#2\n- nodeA =\u003e j5#2\n- nodeA =\u003e j8#2\n- nodeA =\u003e j9#2\n\nAnd nodeB and nodeC are not needed anymore - the cloud plugin can shut them down.\n\nOf course, such a simple implementation has some disadvantages as well:\n- It always tries to use all executors of each node.\n- It does not take into account any kind of history to balance the jobs.\n- Old nodes will have no chance to get replaced.\n\n\nBuilding\n---\n\nPrerequisites:\n\n- JDK 7 (or above)\n- Apache Maven\n\nBuild process is straight forward:\n\n```Shell\nmvn install\n```\n\nBasic Usage\n---\n\nTo get started:\n\n1. Install the plugin.\n1. Go to the Jenkins Configuration.\n1. Find \"Saturate Nodes Load Balancer\".\n1. Enable \"Override default load balancer\".\n\nThe plugin allows you to enable/disable the Load Balancer on-the-fly.\n\nIf you want to monitor its logs, you can add `org.jenkinsci.plugins.saturatenodes.SaturateNodesLoadBalancer` to the [loggers](https://wiki.jenkins-ci.org/display/JENKINS/Logging) of your Jenkins master.\n\nAlso, you can configure the [system Groovy script](https://wiki.jenkins-ci.org/display/JENKINS/Groovy+plugin) and execute it during the night (to minimize number of used nodes in nightly builds):\n```groovy\nimport org.jenkinsci.plugins.saturatenodes.SaturateNodesLoadBalancer\n\nJenkins.getInstance().getQueue().setLoadBalancer(new SaturateNodesLoadBalancer())\n```\nAnd to restore default one:\n```groovy\nimport hudson.model.LoadBalancer\n\nJenkins.getInstance().getQueue().setLoadBalancer(LoadBalancer.CONSISTENT_HASH)\n```\n\nAuthors\n---\n\nAlexander Akbashev - \u003calexander.akbashev@here.com\u003e\n\nLicense\n---\n\nLicensed under the [MIT License (MIT)](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheremaps%2Fsaturate-nodes-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheremaps%2Fsaturate-nodes-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheremaps%2Fsaturate-nodes-plugin/lists"}