Class LeastLoadedPartitionAssignmentStrategy

java.lang.Object
io.github.jchejarla.springbatch.clustering.partition.impl.LeastLoadedPartitionAssignmentStrategy
All Implemented Interfaces:
PartitionAssignmentStrategy

public class LeastLoadedPartitionAssignmentStrategy extends Object implements PartitionAssignmentStrategy
A load-aware strategy that assigns each partition to the node with the lowest current load.

Each node's running load is seeded from the live load it reported (the count of partitions it is already executing, tracked in BATCH_NODES), then incremented locally as partitions are assigned within this call. This spreads new work toward the least-busy nodes and accounts for work a node is already doing for other jobs — unlike round-robin, which ignores existing load. Ties are broken by node order for deterministic assignment.

Author:
Janardhan Chejarla