1
0

[HUDI-2561] BitCaskDiskMap - avoiding hostname resolution when logging messages (#3811)

- InetAddress.getLocalHost() can take up as much as 30+seconds if the network
   configurations are not done right. This might be due to local hostname
   missing IPv6 address mapping in /etc/hosts or network configs slowing down
   any IPv6 name resolutions. If this API is used for logging verbose messages
   and that too in the hot code path, it can lead to order of magnitude
   slowness in the overall task completion.
This commit is contained in:
Manoj Govindassamy
2021-10-18 10:07:53 -07:00
committed by GitHub
parent 588a34aa95
commit 335e80ea1b

View File

@@ -37,7 +37,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.net.InetAddress;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashSet;
@@ -133,9 +132,7 @@ public final class BitCaskDiskMap<T extends Serializable, R extends Serializable
writeOnlyFile.getParentFile().mkdir();
}
writeOnlyFile.createNewFile();
LOG.info("Spilling to file location " + writeOnlyFile.getAbsolutePath() + " in host ("
+ InetAddress.getLocalHost().getHostAddress() + ") with hostname (" + InetAddress.getLocalHost().getHostName()
+ ")");
LOG.debug("Spilling to file location " + writeOnlyFile.getAbsolutePath());
// Make sure file is deleted when JVM exits
writeOnlyFile.deleteOnExit();
}