YARN-4031. Add JvmPauseMonitor to ApplicationHistoryServer and WebAppProxyServer (djp via rkanter)

(cherry picked from commit dc2340c60e)
This commit is contained in:
Robert Kanter 2015-08-12 15:47:47 -07:00
parent 458b684941
commit fbcfca6f91
3 changed files with 45 additions and 4 deletions

View File

@ -344,6 +344,9 @@ Release 2.8.0 - UNRELEASED
YARN-4026. Refactored ContainerAllocator to accept a list of priorites YARN-4026. Refactored ContainerAllocator to accept a list of priorites
rather than a single priority. (Wangda Tan via jianhe) rather than a single priority. (Wangda Tan via jianhe)
YARN-4031. Add JvmPauseMonitor to ApplicationHistoryServer and
WebAppProxyServer (djp via rkanter)
OPTIMIZATIONS OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not YARN-3339. TestDockerContainerExecutor should pull a single image and not

View File

@ -34,6 +34,7 @@
import org.apache.hadoop.service.Service; import org.apache.hadoop.service.Service;
import org.apache.hadoop.util.ExitUtil; import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.JvmPauseMonitor;
import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.ShutdownHookManager; import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
@ -73,6 +74,7 @@ public class ApplicationHistoryServer extends CompositeService {
private TimelineDelegationTokenSecretManagerService secretManagerService; private TimelineDelegationTokenSecretManagerService secretManagerService;
private TimelineDataManager timelineDataManager; private TimelineDataManager timelineDataManager;
private WebApp webApp; private WebApp webApp;
private JvmPauseMonitor pauseMonitor;
public ApplicationHistoryServer() { public ApplicationHistoryServer() {
super(ApplicationHistoryServer.class.getName()); super(ApplicationHistoryServer.class.getName());
@ -96,7 +98,9 @@ protected void serviceInit(Configuration conf) throws Exception {
addService((Service) historyManager); addService((Service) historyManager);
DefaultMetricsSystem.initialize("ApplicationHistoryServer"); DefaultMetricsSystem.initialize("ApplicationHistoryServer");
JvmMetrics.initSingleton("ApplicationHistoryServer", null); JvmMetrics jm = JvmMetrics.initSingleton("ApplicationHistoryServer", null);
pauseMonitor = new JvmPauseMonitor(conf);
jm.setPauseMonitor(pauseMonitor);
super.serviceInit(conf); super.serviceInit(conf);
} }
@ -107,6 +111,10 @@ protected void serviceStart() throws Exception {
} catch(IOException ie) { } catch(IOException ie) {
throw new YarnRuntimeException("Failed to login", ie); throw new YarnRuntimeException("Failed to login", ie);
} }
if (pauseMonitor != null) {
pauseMonitor.start();
}
super.serviceStart(); super.serviceStart();
startWebApp(); startWebApp();
} }
@ -116,7 +124,9 @@ protected void serviceStop() throws Exception {
if (webApp != null) { if (webApp != null) {
webApp.stop(); webApp.stop();
} }
if (pauseMonitor != null) {
pauseMonitor.stop();
}
DefaultMetricsSystem.shutdown(); DefaultMetricsSystem.shutdown();
super.serviceStop(); super.serviceStop();
} }

View File

@ -22,10 +22,13 @@
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.source.JvmMetrics;
import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.util.ExitUtil; import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.JvmPauseMonitor;
import org.apache.hadoop.util.ShutdownHookManager; import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler; import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
@ -48,7 +51,9 @@ public class WebAppProxyServer extends CompositeService {
WebAppProxyServer.class); WebAppProxyServer.class);
private WebAppProxy proxy = null; private WebAppProxy proxy = null;
private JvmPauseMonitor pauseMonitor;
public WebAppProxyServer() { public WebAppProxyServer() {
super(WebAppProxyServer.class.getName()); super(WebAppProxyServer.class.getName());
} }
@ -56,12 +61,35 @@ public WebAppProxyServer() {
@Override @Override
protected void serviceInit(Configuration conf) throws Exception { protected void serviceInit(Configuration conf) throws Exception {
Configuration config = new YarnConfiguration(conf); Configuration config = new YarnConfiguration(conf);
doSecureLogin(conf); doSecureLogin(conf);
proxy = new WebAppProxy(); proxy = new WebAppProxy();
addService(proxy); addService(proxy);
DefaultMetricsSystem.initialize("WebAppProxyServer");
JvmMetrics jm = JvmMetrics.initSingleton("WebAppProxyServer", null);
pauseMonitor = new JvmPauseMonitor(conf);
jm.setPauseMonitor(pauseMonitor);
super.serviceInit(config); super.serviceInit(config);
} }
@Override
protected void serviceStart() throws Exception {
if (pauseMonitor != null) {
pauseMonitor.start();
}
super.serviceStart();
}
@Override
protected void serviceStop() throws Exception {
super.serviceStop();
DefaultMetricsSystem.shutdown();
if (pauseMonitor != null) {
pauseMonitor.stop();
}
}
/** /**
* Log in as the Kerberose principal designated for the proxy * Log in as the Kerberose principal designated for the proxy
* @param conf the configuration holding this information in it. * @param conf the configuration holding this information in it.