Yarn capacity-scheduler queue and app sorting policy

#hadoop #yarn

capacity-scheduler scheduling

  1. daemon thread to pick up the candidates nodemanagers. see: #Attachment#scheduling entry point
  2. and then use the single nodemanager to find out the candidate queue + apps

Question

queue selection is selected by the abs used capacity, when to sub/add used capacity

Only when the container is allocated successfully in the async scheduling commit process, the allocated resource will be added into the queue's usage resources. Please see Attachment#Resource deductions associated code

BTW, if the container is allocated, it will notify the app's ordering policy to reorder the associated app. Detailed code is leaf queue.

orderingPolicy.containerAllocated(  
schedulerContainer.getSchedulerApplicationAttempt(),  
schedulerContainer.getRmContainer());

Is it possible that race condition happens when multi thread to propose commit for the same apps or queue

I think yes, multi threads will choose the same queue and then to get the same apps to allocate.
From the sorting policy, I don't see any avoidance strategies.

Conclusion

When the async scheduling is enabled, the whole scheduling is as follows:

Pasted image 20241121145924.png

Attachment

scheduling entry point

Pasted image 20241121141414.png

Resource deductions associated code

Pasted image 20241121143945.png

queue getting after sorting

Pasted image 20241121141807.png

app getting after sorting in leaf queue

Pasted image 20241121143044.png