You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "Peng Zhang (JIRA)" <ji...@apache.org> on 2015/04/13 16:17:12 UTC

[jira] [Commented] (YARN-3453) Fair Scheduler : Parts of preemption logic uses DefaultResourceCalculator even in DRF mode causing thrashing

    [ https://issues.apache.org/jira/browse/YARN-3453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14492440#comment-14492440 ] 

Peng Zhang commented on YARN-3453:
----------------------------------

[~ashwinshankar77]
I‘ve the same problem in our cluster. I think 2 points should be done to make it work:
# Calculator should be configurable, so isStarved() can use DominantResourceCalculator to test. But this still has corner case: cluster(40960, 8), expected( 16384, 4), real(4096, 4) it still result with "starved". My idea for this is to lower starve threshold to ignore this. Any good suggestions?
# in resToPreempt(), we should change logic of calculation, changing calculator is not enough. My hacked code is like below:
{code}
-      Resource target = Resources.min(getResourceCalculator(), clusterResource,
-          sched.getFairShare(), sched.getDemand());
+      Resource resourceUpperBound = Resources.componentwiseMin(
           sched.getFairShare(), sched.getDemand()); // min value of both cpu and memory as upperBound of request resource
+      float targetRatio = 0;
+        // getResourceAsValue is not super method in ResourceCalculator, and i cannot figure out one name for this calculation logic, so hack like this
+      if (resourceCalculator instanceof DominantResourceCalculator) {
+        // the ratio of demand can be get under resourceUpperBound.
+        targetRatio = ((DominantResourceCalculator)resourceCalculator)
+            .getResourceAsValue(sched.getDemand(), resourceUpperBound, false);  // min of ratio for cpu and memory
+      } else {
+        targetRatio = Resources.ratio(resourceCalculator, sched.getDemand(),
+            resourceUpperBound);
+      }
+      Resource target = Resources.multiply(sched.getDemand(), targetRatio);  // demand resource can be fulfilled under fair share. 
{code} 

Besides "drf" policy problem with preemption, I also filed YARN-3405 to describe some common problems with preemption.

> Fair Scheduler : Parts of preemption logic uses DefaultResourceCalculator even in DRF mode causing thrashing
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-3453
>                 URL: https://issues.apache.org/jira/browse/YARN-3453
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: fairscheduler
>    Affects Versions: 2.6.0
>            Reporter: Ashwin Shankar
>
> There are two places in preemption code flow where DefaultResourceCalculator is used, even in DRF mode.
> Which basically results in more resources getting preempted than needed, and those extra preempted containers aren’t even getting to the “starved” queue since scheduling logic is based on DRF's Calculator.
> Following are the two places :
> 1. {code:title=FSLeafQueue.java|borderStyle=solid}
> private boolean isStarved(Resource share)
> {code}
> A queue shouldn’t be marked as “starved” if the dominant resource usage
> is >=  fair/minshare.
> 2. {code:title=FairScheduler.java|borderStyle=solid}
> protected Resource resToPreempt(FSLeafQueue sched, long curTime)
> {code}
> --------------------------------------------------------------
> One more thing that I believe needs to change in DRF mode is : during a preemption round,if preempting a few containers results in satisfying needs of a resource type, then we should exit that preemption round, since the containers that we just preempted should bring the dominant resource usage to min/fair share.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)