hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "He Xiaoqiao (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-15343) NetworkTopology#getLoc should exit loop earlier rather than traverse all children
Date Tue, 27 Mar 2018 04:54:00 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-15343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

He Xiaoqiao updated HADOOP-15343:
---------------------------------
    Resolution: Duplicate
        Status: Resolved  (was: Patch Available)

> 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: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message