Class LeastLoadBalancer

java.lang.Object
hudson.model.LoadBalancer
org.bstick12.jenkinsci.plugins.leastload.LeastLoadBalancer
All Implemented Interfaces:
ExtensionPoint

public class LeastLoadBalancer extends LoadBalancer
A LoadBalancer implementation that the leastload plugin uses to replace the default Jenkins LoadBalancer

The LeastLoadBalancer chooses Executors that have the least load. An Executor is defined as having the least load if it is idle or has the most available Executors

Only executor chunks that are clearly available (node non-null, not offline) are considered. The balancer tracks nodes that have not yet been assigned work this "round"; it assigns to a known-empty node uniquely. When all tracked nodes have been used, it re-checks Jenkins for currently available nodes (online, accepting tasks, with idle executors) and starts a new round. This spreads load and avoids multiple jobs piling on the same agent before queue maintenance runs again.

When least-load cannot produce a mapping, it returns null so the task remains in the queue for the next cycle. The fallback load balancer is used only when least-load is disabled for the job via LeastLoadDisabledProperty.

Author:
brendan.nolan@gmail.com