Class NodeQueueLoadMonitor
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.NodeQueueLoadMonitor
- All Implemented Interfaces:
ClusterMonitor
The NodeQueueLoadMonitor keeps track of load metrics (such as queue length
and total wait time) associated with Container Queues on the Node Manager.
It uses this information to periodically sort the Nodes from least to most
loaded.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe comparator used to specify the metric against which the load of two Nodes are compared. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<org.apache.hadoop.yarn.api.records.NodeId,ClusterNode> protected ReentrantReadWriteLockprotected final NodeQueueLoadMonitor.LoadComparatorprotected static final org.slf4j.Loggerprotected intprotected final List<org.apache.hadoop.yarn.api.records.NodeId>protected ReentrantReadWriteLockprotected QueueLimitCalculator -
Constructor Summary
ConstructorsConstructorDescriptionNodeQueueLoadMonitor(long nodeComputationInterval, NodeQueueLoadMonitor.LoadComparator comparator, int numNodes) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddIntoNodeIdsByRack(RMNode addedNode) voidaddNode(List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containerStatuses, RMNode rmNode) protected List<org.apache.hadoop.yarn.api.records.NodeId>voidinitThresholdCalculator(float sigma, int limitMin, int limitMax) protected voidonExistingNodeUpdated(RMNode rmNode, ClusterNode clusterNode, org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus status) protected voidonNewNodeAdded(RMNode rmNode, org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus status) protected voidonNodeRemoved(ClusterNode node) Provide an integration point for extended classprotected voidremoveFromNodeIdsByRack(RMNode removedNode) voidremoveNode(RMNode removedRMNode) selectAnyNode(Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects a node from all ClusterNodes for resource allocation, excluding blacklisted nodes.List<org.apache.hadoop.yarn.api.records.NodeId>selectLeastLoadedNodes(int k) Returns 'K' of the least Loaded Node Ids as ordered list.selectLocalNode(String hostName, Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects the node as specified by hostName for resource allocation, unless the node has been blacklisted.List<org.apache.hadoop.yarn.api.records.NodeId>Returns all Node Ids as ordered list from Least to Most Loaded.selectRackLocalNode(String rackName, Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects a node from the rack as specified by rackName for resource allocation, excluding blacklisted nodesprotected List<ClusterNode>sortNodes(boolean excludeFullNodes) voidstart()voidstop()voidupdateNode(RMNode rmNode) voidupdateNodeResource(RMNode rmNode, org.apache.hadoop.yarn.api.records.ResourceOption resourceOption) protected void
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
numNodesForAnyAllocation
protected int numNodesForAnyAllocation -
sortedNodes
-
clusterNodes
-
nodeByHostName
-
nodeIdsByRack
-
comparator
-
thresholdCalculator
-
sortedNodesLock
-
clusterNodesLock
-
-
Constructor Details
-
NodeQueueLoadMonitor
public NodeQueueLoadMonitor(long nodeComputationInterval, NodeQueueLoadMonitor.LoadComparator comparator, int numNodes)
-
-
Method Details
-
start
public void start() -
updateSortedNodes
protected void updateSortedNodes() -
getThresholdCalculator
-
stop
public void stop() -
initThresholdCalculator
public void initThresholdCalculator(float sigma, int limitMin, int limitMax) -
addNode
public void addNode(List<org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus> containerStatuses, RMNode rmNode) - Specified by:
addNodein interfaceClusterMonitor
-
removeNode
- Specified by:
removeNodein interfaceClusterMonitor
-
onNodeRemoved
Provide an integration point for extended class- Parameters:
node- the node removed
-
updateNode
- Specified by:
updateNodein interfaceClusterMonitor
-
onNewNodeAdded
protected void onNewNodeAdded(RMNode rmNode, org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus status) -
onExistingNodeUpdated
protected void onExistingNodeUpdated(RMNode rmNode, ClusterNode clusterNode, org.apache.hadoop.yarn.server.api.records.OpportunisticContainersStatus status) -
updateNodeResource
public void updateNodeResource(RMNode rmNode, org.apache.hadoop.yarn.api.records.ResourceOption resourceOption) - Specified by:
updateNodeResourcein interfaceClusterMonitor
-
selectNodes
Returns all Node Ids as ordered list from Least to Most Loaded.- Returns:
- ordered list of nodes
-
selectLeastLoadedNodes
Returns 'K' of the least Loaded Node Ids as ordered list.- Parameters:
k- max number of nodes to return- Returns:
- ordered list of nodes
-
selectLocalNode
public RMNode selectLocalNode(String hostName, Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects the node as specified by hostName for resource allocation, unless the node has been blacklisted.- Parameters:
hostName- the hostname of the node for local resource allocationblacklist- the blacklisted nodesrequest- the requested resource- Returns:
- the selected node, null if the node is full or is blacklisted
-
selectRackLocalNode
public RMNode selectRackLocalNode(String rackName, Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects a node from the rack as specified by rackName for resource allocation, excluding blacklisted nodes- Parameters:
rackName- the rack name for rack-local resource allocationblacklist- the blacklisted nodesrequest- the requested resource- Returns:
- the selected node, null if no suitable nodes
-
selectAnyNode
public RMNode selectAnyNode(Set<String> blacklist, org.apache.hadoop.yarn.api.records.Resource request) Selects a node from all ClusterNodes for resource allocation, excluding blacklisted nodes.- Parameters:
blacklist- the blacklisted nodesrequest- the requested resource- Returns:
- the selected node, null if no suitable nodes
-
getCandidatesForSelectAnyNode
-
removeFromNodeIdsByRack
-
addIntoNodeIdsByRack
-
sortNodes
-