Class CpuUsageStrategy<T extends Endpoint>
java.lang.Object
services.moleculer.strategy.Strategy<T>
services.moleculer.strategy.ArrayBasedStrategy<T>
services.moleculer.strategy.XorShiftRandomStrategy<T>
services.moleculer.strategy.CpuUsageStrategy<T>
Lowest CPU usage invocation strategy. This strategy comes from a random
strategy, but preferably communicates with the "least loaded" nodes (nodes
with the lowest CPU usage).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intlowCpuUsage ~= zero CPU usageprotected final intThis strategy compares number of 'sampleCount' random node.protected final TransporterFields inherited from class XorShiftRandomStrategy
rndFields inherited from class ArrayBasedStrategy
endpointCache, endpoints, nodeID, preferLocal -
Constructor Summary
ConstructorsConstructorDescriptionCpuUsageStrategy(ServiceBroker broker, boolean preferLocal, int sampleCount, int lowCpuUsage, Transporter transporter) -
Method Summary
Methods inherited from class ArrayBasedStrategy
addEndpoint, getAllEndpoints, getEndpoint, getEndpointsByNodeID, isEmpty, remove
-
Field Details
-
sampleCount
protected final int sampleCountThis strategy compares number of 'sampleCount' random node. -
lowCpuUsage
protected final int lowCpuUsagelowCpuUsage ~= zero CPU usage -
transporter
-
-
Constructor Details
-
CpuUsageStrategy
public CpuUsageStrategy(ServiceBroker broker, boolean preferLocal, int sampleCount, int lowCpuUsage, Transporter transporter)
-
-
Method Details
-
next
-