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

zhihai xu commented on YARN-2756:
---------------------------------

Hi [~leftnoteasy]

bq. but you cannot say in the future, some guys may write like 
node.resource.setMemory(...), basically I think it's a bad style. That will 
throw runtime exception and destroy YARN daemons, comparing to memory it can 
save, the risk is much more serious, do you agree?

IMO we should not permit people to call node.resource.setMemory(...) to change 
the node memory when the node is not running. Currently the only way to change 
the node memory from scheduler is by activateNode/deactivateNode.
The patch will force this constraint: when the node is not running, the 
resource in the node can't be change. We can only change the resource in the 
node when the node is running. In the future, if we really want to change the 
rule/constraint, we can change the implementation/architecture. But I don't see 
we need change the rule/constraint now or in the near future.
Saving memory is the second benefit for this patch.

thanks
zhihai

> use static variable (Resources.none()) for not-running Node.resource in 
> CommonNodeLabelsManager to save memory.
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-2756
>                 URL: https://issues.apache.org/jira/browse/YARN-2756
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>            Priority: Minor
>         Attachments: YARN-2756.000.patch
>
>
> use static variable (Resources.none()) for not-running Node.resource in 
> CommonNodeLabelsManager to save memory. When a Node is not activated, the 
> resource is never used, When a Node is activated, a new resource will be 
> assigned to it in RMNodeLabelsManager#activateNode (nm.resource = resource) 
> So it would be better to use static variable Resources.none() instead of 
> allocating a new variable(Resource.newInstance(0, 0)) for each node 
> deactivation.



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

Reply via email to