parakhnr commented on code in PR #2452:
URL: https://github.com/apache/helix/pull/2452#discussion_r1171656029
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkServer.java:
##########
@@ -83,55 +80,25 @@ public int getPort() {
@PostConstruct
public void start() {
- final String[] localHostNames = NetworkUtil.getLocalHostNames();
- String names = "";
- for (int i = 0; i < localHostNames.length; i++) {
- final String name = localHostNames[i];
- names += " " + name;
- if (i + 1 != localHostNames.length) {
- names += ",";
- }
- }
- LOG.info("Starting ZkServer on: [" + names + "] port " + _port +
"...");
startZooKeeperServer();
_zkClient = new ZkClient(new ZkConnection("localhost:" + _port),
10000, -1, new BasicZkSerializer(new SerializableSerializer()), null, null,
null, false);
_defaultNameSpace.createDefaultNameSpace(_zkClient);
}
private void startZooKeeperServer() {
- final String[] localhostHostNames = NetworkUtil.getLocalHostNames();
Review Comment:
I ran the experiment locally where I queried
`NetworkUtil.getLocalHostNames()` in loop for 10 times. The total time for each
iteration is ~50seconds and most expensive operation is
`InetAddress.getCanonicalHostName()` which took ~5seconds.
NOTE: The number varies on number of the Network interfaces on the machine
and number of IP addresses bound to that network interface. In the experiment
above I had 10 Network interfaces and each network interface had 1 IP address
associated with it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]