[
https://issues.apache.org/jira/browse/HADOOP-15343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16414246#comment-16414246
]
Rushabh S Shah commented on HADOOP-15343:
-----------------------------------------
Does it make sense to backport HADOOP-12185 to branch-2.7 ?
HADOOP-12185 is trying to solve the in-efficiencies in adding/getting/removing
nodes from {{NetworkTopology}}.
I understand this jira is subset of HADOOP-12185 but doesn't hurt getting more
performance benefits.
> NetworkTopology#getLoc should exit loop earlier rather than traverse all
> children
> ---------------------------------------------------------------------------------
>
> Key: HADOOP-15343
> URL: https://issues.apache.org/jira/browse/HADOOP-15343
> Project: Hadoop Common
> Issue Type: Improvement
> Components: performance
> Affects Versions: 2.7.6
> Reporter: He Xiaoqiao
> Priority: Major
> Labels: performance
> Attachments: HADOOP-15343-branch-2.7.001.patch
>
>
> NetworkTopology#getLoc return a proper node after traverse ALL children of
> current {{InnerNode}} even if it has found expected result, based on
> branch-2.7. This issue may lead some performance loss especially for a large
> & busy cluster and many nodes under a rack. I think it should exit loop
> earlier rather than traverse all children of {{InnerNode}}.
> {code:java}
> private Node getLoc(String loc) {
> if (loc == null || loc.length() == 0) return this;
>
> String[] path = loc.split(PATH_SEPARATOR_STR, 2);
> Node childnode = null;
> for(int i=0; i<children.size(); i++) {
> if (children.get(i).getName().equals(path[0])) {
> childnode = children.get(i);
> }
> }
> if (childnode == null) return null; // non-existing node
> if (path.length == 1) return childnode;
> if (childnode instanceof InnerNode) {
> return ((InnerNode)childnode).getLoc(path[1]);
> } else {
> return null;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]