YARN-538. RM address DNS lookup can cause unnecessary slowness on every JHS page load. (sandyr via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1464197 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-04-03 20:41:57 +00:00
parent 0e9f61addc
commit 2100e93b04
2 changed files with 7 additions and 9 deletions

View File

@ -185,6 +185,9 @@ Release 2.0.5-beta - UNRELEASED
YARN-101. Fix NodeManager heartbeat processing to not lose track of completed YARN-101. Fix NodeManager heartbeat processing to not lose track of completed
containers in case of dropped heartbeats. (Xuan Gong via vinodkv) containers in case of dropped heartbeats. (Xuan Gong via vinodkv)
YARN-538. RM address DNS lookup can cause unnecessary slowness on every JHS
page load. (sandyr via tucu)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -717,21 +717,16 @@ public static String getProxyHostAndPort(Configuration conf) {
} }
public static String getRMWebAppHostAndPort(Configuration conf) { public static String getRMWebAppHostAndPort(Configuration conf) {
int port = conf.getSocketAddr( InetSocketAddress address = conf.getSocketAddr(
YarnConfiguration.RM_WEBAPP_ADDRESS, YarnConfiguration.RM_WEBAPP_ADDRESS,
YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
YarnConfiguration.DEFAULT_RM_WEBAPP_PORT).getPort(); YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
// Use apps manager address to figure out the host for webapp address = NetUtils.getConnectAddress(address);
String host = conf.getSocketAddr(
YarnConfiguration.RM_ADDRESS,
YarnConfiguration.DEFAULT_RM_ADDRESS,
YarnConfiguration.DEFAULT_RM_PORT).getHostName();
InetSocketAddress address = NetUtils.createSocketAddrForHost(host, port);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
InetAddress resolved = address.getAddress(); InetAddress resolved = address.getAddress();
if (resolved == null || resolved.isAnyLocalAddress() || if (resolved == null || resolved.isAnyLocalAddress() ||
resolved.isLoopbackAddress()) { resolved.isLoopbackAddress()) {
String lh = host; String lh = address.getHostName();
try { try {
lh = InetAddress.getLocalHost().getCanonicalHostName(); lh = InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {