Search in sources :

Example 6 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class WebAppProxyServer method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    Configuration config = new YarnConfiguration(conf);
    doSecureLogin(conf);
    proxy = new WebAppProxy();
    addService(proxy);
    DefaultMetricsSystem.initialize("WebAppProxyServer");
    JvmMetrics jm = JvmMetrics.initSingleton("WebAppProxyServer", null);
    pauseMonitor = new JvmPauseMonitor();
    addService(pauseMonitor);
    jm.setPauseMonitor(pauseMonitor);
    super.serviceInit(config);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) JvmMetrics(org.apache.hadoop.metrics2.source.JvmMetrics) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor)

Example 7 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class TestJvmMetrics method testPresence.

@Test
public void testPresence() {
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(new Configuration());
    pauseMonitor.start();
    JvmMetrics jvmMetrics = new JvmMetrics("test", "test");
    jvmMetrics.setPauseMonitor(pauseMonitor);
    MetricsRecordBuilder rb = getMetrics(jvmMetrics);
    MetricsCollector mc = rb.parent();
    verify(mc).addRecord(JvmMetrics);
    verify(rb).tag(ProcessName, "test");
    verify(rb).tag(SessionId, "test");
    for (JvmMetricsInfo info : JvmMetricsInfo.values()) {
        if (info.name().startsWith("Mem"))
            verify(rb).addGauge(eq(info), anyFloat());
        else if (info.name().startsWith("Gc"))
            verify(rb).addCounter(eq(info), anyLong());
        else if (info.name().startsWith("Threads"))
            verify(rb).addGauge(eq(info), anyInt());
        else if (info.name().startsWith("Log"))
            verify(rb).addCounter(eq(info), anyLong());
    }
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) Configuration(org.apache.hadoop.conf.Configuration) JvmMetricsInfo(org.apache.hadoop.metrics2.source.JvmMetricsInfo) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder) Test(org.junit.Test)

Example 8 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class TestJvmMetrics method testStopBeforeStart.

@Test
public void testStopBeforeStart() throws Throwable {
    pauseMonitor = new JvmPauseMonitor();
    try {
        pauseMonitor.init(new Configuration());
        pauseMonitor.stop();
        pauseMonitor.start();
        Assert.fail("Expected an exception, got " + pauseMonitor);
    } catch (ServiceStateException e) {
        GenericTestUtils.assertExceptionContains("cannot enter state", e);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) ServiceStateException(org.apache.hadoop.service.ServiceStateException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) Test(org.junit.Test)

Example 9 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class TestJvmMetrics method testDoubleStop.

@Test
public void testDoubleStop() throws Throwable {
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(new Configuration());
    pauseMonitor.start();
    pauseMonitor.stop();
    pauseMonitor.stop();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) Test(org.junit.Test)

Example 10 with JvmPauseMonitor

use of org.apache.hadoop.util.JvmPauseMonitor in project hadoop by apache.

the class DataNode method startDataNode.

/**
   * This method starts the data node with the specified conf.
   * 
   * If conf's CONFIG_PROPERTY_SIMULATED property is set
   * then a simulated storage based data node is created.
   * 
   * @param dataDirectories - only for a non-simulated storage data node
   * @throws IOException
   */
void startDataNode(List<StorageLocation> dataDirectories, SecureResources resources) throws IOException {
    // settings global for all BPs in the Data Node
    this.secureResources = resources;
    synchronized (this) {
        this.dataDirs = dataDirectories;
    }
    this.dnConf = new DNConf(this);
    checkSecureConfig(dnConf, getConf(), resources);
    if (dnConf.maxLockedMemory > 0) {
        if (!NativeIO.POSIX.getCacheManipulator().verifyCanMlock()) {
            throw new RuntimeException(String.format("Cannot start datanode because the configured max locked memory" + " size (%s) is greater than zero and native code is not available.", DFS_DATANODE_MAX_LOCKED_MEMORY_KEY));
        }
        if (Path.WINDOWS) {
            NativeIO.Windows.extendWorkingSetSize(dnConf.maxLockedMemory);
        } else {
            long ulimit = NativeIO.POSIX.getCacheManipulator().getMemlockLimit();
            if (dnConf.maxLockedMemory > ulimit) {
                throw new RuntimeException(String.format("Cannot start datanode because the configured max locked memory" + " size (%s) of %d bytes is more than the datanode's available" + " RLIMIT_MEMLOCK ulimit of %d bytes.", DFS_DATANODE_MAX_LOCKED_MEMORY_KEY, dnConf.maxLockedMemory, ulimit));
            }
        }
    }
    LOG.info("Starting DataNode with maxLockedMemory = " + dnConf.maxLockedMemory);
    int volFailuresTolerated = dnConf.getVolFailuresTolerated();
    int volsConfigured = dnConf.getVolsConfigured();
    if (volFailuresTolerated < 0 || volFailuresTolerated >= volsConfigured) {
        throw new DiskErrorException("Invalid value configured for " + "dfs.datanode.failed.volumes.tolerated - " + volFailuresTolerated + ". Value configured is either less than 0 or >= " + "to the number of configured volumes (" + volsConfigured + ").");
    }
    storage = new DataStorage();
    // global DN settings
    registerMXBean();
    initDataXceiver();
    startInfoServer();
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(getConf());
    pauseMonitor.start();
    // BlockPoolTokenSecretManager is required to create ipc server.
    this.blockPoolTokenSecretManager = new BlockPoolTokenSecretManager();
    // Login is done by now. Set the DN user name.
    dnUserName = UserGroupInformation.getCurrentUser().getUserName();
    LOG.info("dnUserName = " + dnUserName);
    LOG.info("supergroup = " + supergroup);
    initIpcServer();
    metrics = DataNodeMetrics.create(getConf(), getDisplayName());
    peerMetrics = dnConf.peerStatsEnabled ? DataNodePeerMetrics.create(getConf(), getDisplayName()) : null;
    metrics.getJvmMetrics().setPauseMonitor(pauseMonitor);
    ecWorker = new ErasureCodingWorker(getConf(), this);
    blockRecoveryWorker = new BlockRecoveryWorker(this);
    blockPoolManager = new BlockPoolManager(this);
    blockPoolManager.refreshNamenodes(getConf());
    // Create the ReadaheadPool from the DataNode context so we can
    // exit without having to explicitly shutdown its thread pool.
    readaheadPool = ReadaheadPool.getInstance();
    saslClient = new SaslDataTransferClient(dnConf.getConf(), dnConf.saslPropsResolver, dnConf.trustedChannelResolver);
    saslServer = new SaslDataTransferServer(dnConf, blockPoolTokenSecretManager);
    startMetricsLogger();
    if (dnConf.diskStatsEnabled) {
        diskMetrics = new DataNodeDiskMetrics(this, dnConf.outliersReportIntervalMs);
    }
}
Also used : DataNodeDiskMetrics(org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeDiskMetrics) ErasureCodingWorker(org.apache.hadoop.hdfs.server.datanode.erasurecode.ErasureCodingWorker) DiskErrorException(org.apache.hadoop.util.DiskChecker.DiskErrorException) SaslDataTransferServer(org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferServer) BlockPoolTokenSecretManager(org.apache.hadoop.hdfs.security.token.block.BlockPoolTokenSecretManager) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) SaslDataTransferClient(org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferClient)

Aggregations

JvmPauseMonitor (org.apache.hadoop.util.JvmPauseMonitor)12 Configuration (org.apache.hadoop.conf.Configuration)7 Test (org.junit.Test)5 IOException (java.io.IOException)4 JvmMetrics (org.apache.hadoop.metrics2.source.JvmMetrics)3 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)3 ServiceStateException (org.apache.hadoop.service.ServiceStateException)2 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)2 SaslDataTransferClient (org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferClient)1 SaslDataTransferServer (org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferServer)1 BlockPoolTokenSecretManager (org.apache.hadoop.hdfs.security.token.block.BlockPoolTokenSecretManager)1 ErasureCodingWorker (org.apache.hadoop.hdfs.server.datanode.erasurecode.ErasureCodingWorker)1 DataNodeDiskMetrics (org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeDiskMetrics)1 HSAdminServer (org.apache.hadoop.mapreduce.v2.hs.server.HSAdminServer)1 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)1 MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)1 JvmMetricsInfo (org.apache.hadoop.metrics2.source.JvmMetricsInfo)1 DiskErrorException (org.apache.hadoop.util.DiskChecker.DiskErrorException)1 AsyncDispatcher (org.apache.hadoop.yarn.event.AsyncDispatcher)1 AggregatedLogDeletionService (org.apache.hadoop.yarn.logaggregation.AggregatedLogDeletionService)1