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

Daniel Templeton commented on YARN-6610:
----------------------------------------

Thanks for the review.  I don't see how to avoid sorting the shares in 
{{DRC#compare()}}.  We have to compare the two resources' shares in order of 
dominance, which requires that we order them by dominance.  Instead of sorting 
we could hunt for the dominant share by going through the arrays, which would 
be faster than sorting only if the dominant shares aren't equal.  Worst case is 
that all shares are equal, which makes that approach slower than sorting.  It 
seems to me that it's too early to optimize this part.

#2 is an interesting point.  It shouldn't ever happen that resources disagree 
on how many resource types there are.  If it happens, it's a critical issue 
that should take the RM down.  We could put the whole thing in a _try/catch_ to 
have the RM go down with a friendlier message than an 
{{ArrayIndexOutOfBoundsException}}, but there is a small cost to adding the 
_try_ block, mostly that we limit some kinds of compiler optimizations.  I 
think it's probably worth it, though.

For #3, we can't do the comparison until we've sorted the shares arrays.  Even 
if we were to try being clever about merging the sort into the calculation, 
we'd still need another pass to do the comparison.

> DominantResourceCalculator.getResourceAsValue() dominant param is no longer 
> appropriate
> ---------------------------------------------------------------------------------------
>
>                 Key: YARN-6610
>                 URL: https://issues.apache.org/jira/browse/YARN-6610
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>    Affects Versions: YARN-3926
>            Reporter: Daniel Templeton
>            Assignee: Daniel Templeton
>            Priority: Critical
>         Attachments: YARN-6610.001.patch, YARN-6610.YARN-3926.002.patch, 
> YARN-6610.YARN-3926.003.patch, YARN-6610.YARN-3926.004.patch
>
>
> The {{dominant}} param assumes there are only two resources, i.e. true means 
> to compare the dominant, and false means to compare the subordinate.  Now 
> that there are _n_ resources, this parameter no longer makes sense.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to