Search in sources :

Example 1 with LlapManagementProtocolClientImpl

use of org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl in project hive by apache.

the class LlapMetricsCollector method onCreate.

@Override
public void onCreate(LlapServiceInstance serviceInstance, int ephSeqVersion) {
    LlapManagementProtocolClientImpl client = clientFactory.create(serviceInstance);
    llapClients.put(serviceInstance.getWorkerIdentity(), client);
}
Also used : LlapManagementProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl)

Example 2 with LlapManagementProtocolClientImpl

use of org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl in project hive by apache.

the class TestLlapDaemonProtocolServerImpl method testSetCapacity.

@Test(timeout = 10000)
public void testSetCapacity() throws ServiceException, IOException {
    LlapDaemonConfiguration daemonConf = new LlapDaemonConfiguration();
    int numHandlers = HiveConf.getIntVar(daemonConf, ConfVars.LLAP_DAEMON_RPC_NUM_HANDLERS);
    ContainerRunner containerRunnerMock = mock(ContainerRunner.class);
    when(containerRunnerMock.setCapacity(any(SetCapacityRequestProto.class))).thenReturn(SetCapacityResponseProto.newBuilder().build());
    LlapDaemonExecutorMetrics executorMetrics = LlapDaemonExecutorMetrics.create("LLAP", "SessionId", numHandlers, 1, new int[] { 30, 60, 300 }, 0, 0L, 0);
    LlapProtocolServerImpl server = new LlapProtocolServerImpl(null, numHandlers, containerRunnerMock, new AtomicReference<InetSocketAddress>(), new AtomicReference<InetSocketAddress>(), 0, 0, 0, null, executorMetrics);
    try {
        server.init(new Configuration());
        server.start();
        InetSocketAddress serverAddr = server.getManagementBindAddress();
        LlapManagementProtocolPB client = new LlapManagementProtocolClientImpl(new Configuration(), serverAddr.getHostName(), serverAddr.getPort(), null, null);
        client.setCapacity(null, SetCapacityRequestProto.newBuilder().setExecutorNum(1).setQueueSize(1).build());
    } finally {
        server.stop();
    }
}
Also used : LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) ContainerRunner(org.apache.hadoop.hive.llap.daemon.ContainerRunner) LlapManagementProtocolPB(org.apache.hadoop.hive.llap.protocol.LlapManagementProtocolPB) Configuration(org.apache.hadoop.conf.Configuration) LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) LlapDaemonExecutorMetrics(org.apache.hadoop.hive.llap.metrics.LlapDaemonExecutorMetrics) InetSocketAddress(java.net.InetSocketAddress) LlapManagementProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl) SetCapacityRequestProto(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SetCapacityRequestProto) Test(org.junit.Test)

Example 3 with LlapManagementProtocolClientImpl

use of org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl in project hive by apache.

the class TestLlapDaemonProtocolServerImpl method testGetDaemonMetrics.

@Test(timeout = 10000)
public void testGetDaemonMetrics() throws ServiceException, IOException {
    LlapDaemonConfiguration daemonConf = new LlapDaemonConfiguration();
    int numHandlers = HiveConf.getIntVar(daemonConf, ConfVars.LLAP_DAEMON_RPC_NUM_HANDLERS);
    LlapDaemonExecutorMetrics executorMetrics = LlapDaemonExecutorMetrics.create("LLAP", "SessionId", numHandlers, 1, new int[] { 30, 60, 300 }, 0, 0L, 0);
    LlapProtocolServerImpl server = new LlapProtocolServerImpl(null, numHandlers, null, new AtomicReference<InetSocketAddress>(), new AtomicReference<InetSocketAddress>(), 0, 0, 0, null, executorMetrics);
    executorMetrics.addMetricsFallOffFailedTimeLost(10);
    executorMetrics.addMetricsFallOffKilledTimeLost(11);
    executorMetrics.addMetricsFallOffSuccessTimeLost(12);
    executorMetrics.addMetricsPreemptionTimeLost(13);
    executorMetrics.addMetricsPreemptionTimeToKill(14);
    executorMetrics.incrExecutorTotalExecutionFailed();
    executorMetrics.incrExecutorTotalKilled();
    executorMetrics.incrExecutorTotalRequestsHandled();
    executorMetrics.incrExecutorTotalSuccess();
    executorMetrics.incrTotalEvictedFromWaitQueue();
    executorMetrics.incrTotalRejectedRequests();
    executorMetrics.setCacheMemoryPerInstance(15);
    executorMetrics.setExecutorNumPreemptableRequests(16);
    executorMetrics.setExecutorNumQueuedRequests(17);
    executorMetrics.setJvmMaxMemory(18);
    executorMetrics.setMemoryPerInstance(19);
    executorMetrics.setNumExecutorsAvailable(20);
    executorMetrics.setWaitQueueSize(21);
    try {
        server.init(new Configuration());
        server.start();
        InetSocketAddress serverAddr = server.getManagementBindAddress();
        LlapManagementProtocolPB client = new LlapManagementProtocolClientImpl(new Configuration(), serverAddr.getHostName(), serverAddr.getPort(), null, null);
        GetDaemonMetricsResponseProto responseProto = client.getDaemonMetrics(null, GetDaemonMetricsRequestProto.newBuilder().build());
        Map<String, Long> result = new HashMap<>(responseProto.getMetricsCount());
        responseProto.getMetricsList().forEach(me -> result.put(me.getKey(), me.getValue()));
        assertTrue("Checking ExecutorFallOffFailedTimeLost", result.get("ExecutorFallOffFailedTimeLost") == 10);
        assertTrue("Checking ExecutorFallOffKilledTimeLost", result.get("ExecutorFallOffKilledTimeLost") == 11);
        assertTrue("Checking ExecutorFallOffSuccessTimeLost", result.get("ExecutorFallOffSuccessTimeLost") == 12);
        assertTrue("Checking ExecutorTotalPreemptionTimeLost", result.get("ExecutorTotalPreemptionTimeLost") == 13);
        assertTrue("Checking ExecutorTotalPreemptionTimeToKill", result.get("ExecutorTotalPreemptionTimeToKill") == 14);
        assertTrue("Checking ExecutorTotalFailed", result.get("ExecutorTotalFailed") == 1);
        assertTrue("Checking ExecutorTotalKilled", result.get("ExecutorTotalKilled") == 1);
        assertTrue("Checking ExecutorTotalRequestsHandled", result.get("ExecutorTotalRequestsHandled") == 1);
        assertTrue("Checking ExecutorTotalSuccess", result.get("ExecutorTotalSuccess") == 1);
        assertTrue("Checking ExecutorTotalEvictedFromWaitQueue", result.get("ExecutorTotalEvictedFromWaitQueue") == 1);
        assertTrue("Checking ExecutorTotalRejectedRequests", result.get("ExecutorTotalRejectedRequests") == 1);
        assertTrue("Checking ExecutorCacheMemoryPerInstance", result.get("ExecutorCacheMemoryPerInstance") == 15);
        assertTrue("Checking ExecutorNumPreemptableRequests", result.get("ExecutorNumPreemptableRequests") == 16);
        assertTrue("Checking ExecutorNumQueuedRequests", result.get("ExecutorNumQueuedRequests") == 17);
        assertTrue("Checking ExecutorJvmMaxMemory", result.get("ExecutorJvmMaxMemory") == 18);
        assertTrue("Checking ExecutorMemoryPerInstance", result.get("ExecutorMemoryPerInstance") == 19);
        assertTrue("Checking ExecutorNumExecutorsAvailable", result.get("ExecutorNumExecutorsAvailable") == 20);
        assertTrue("Checking ExecutorWaitQueueSize", result.get("ExecutorWaitQueueSize") == 21);
    } finally {
        server.stop();
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) LlapDaemonExecutorMetrics(org.apache.hadoop.hive.llap.metrics.LlapDaemonExecutorMetrics) HashMap(java.util.HashMap) InetSocketAddress(java.net.InetSocketAddress) LlapDaemonConfiguration(org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration) LlapManagementProtocolPB(org.apache.hadoop.hive.llap.protocol.LlapManagementProtocolPB) GetDaemonMetricsResponseProto(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto) LlapManagementProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl) Test(org.junit.Test)

Example 4 with LlapManagementProtocolClientImpl

use of org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl in project hive by apache.

the class BlacklistingLlapMetricsListener method setCapacity.

protected void setCapacity(String workerIdentity, int newExecutorNum, int newWaitQueueSize) throws IOException, ServiceException {
    long currentTime = System.currentTimeMillis();
    if (currentTime > nextCheckTime) {
        LlapZookeeperRegistryImpl.ConfigChangeLockResult lockResult = registry.lockForConfigChange(currentTime, currentTime + this.minConfigChangeDelayMs);
        LOG.debug("Got result for lock check: {}", lockResult);
        if (lockResult.isSuccess()) {
            LOG.info("Setting capacity for workerIdentity={} to newExecutorNum={}, newWaitQueueSize={}", workerIdentity, newExecutorNum, newWaitQueueSize);
            LlapServiceInstance serviceInstance = registry.getInstances().getInstance(workerIdentity);
            LlapManagementProtocolClientImpl client = clientFactory.create(serviceInstance);
            client.setCapacity(null, SetCapacityRequestProto.newBuilder().setExecutorNum(newExecutorNum).setQueueSize(newWaitQueueSize).build());
        }
        if (lockResult.getNextConfigChangeTime() > -1L) {
            nextCheckTime = lockResult.getNextConfigChangeTime();
        }
    } else {
        LOG.debug("Skipping check. Current time {} and we are waiting for {}.", currentTime, nextCheckTime);
    }
}
Also used : LlapZookeeperRegistryImpl(org.apache.hadoop.hive.llap.registry.impl.LlapZookeeperRegistryImpl) LlapServiceInstance(org.apache.hadoop.hive.llap.registry.LlapServiceInstance) LlapManagementProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl)

Example 5 with LlapManagementProtocolClientImpl

use of org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl in project hive by apache.

the class LlapMetricsCollector method collectMetrics.

@VisibleForTesting
void collectMetrics() {
    for (Map.Entry<String, LlapManagementProtocolClientImpl> entry : llapClients.entrySet()) {
        String identity = entry.getKey();
        LlapManagementProtocolClientImpl client = entry.getValue();
        try {
            LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto metrics = client.getDaemonMetrics(null, LlapDaemonProtocolProtos.GetDaemonMetricsRequestProto.newBuilder().build());
            LlapMetrics newMetrics = new LlapMetrics(metrics);
            instanceStatisticsMap.put(identity, newMetrics);
            if (listener != null) {
                try {
                    listener.newDaemonMetrics(identity, newMetrics);
                } catch (Throwable t) {
                    LOG.warn("LlapMetricsListener thrown an unexpected exception", t);
                }
            }
        } catch (ServiceException ex) {
            LOG.error(ex.getMessage(), ex);
            instanceStatisticsMap.remove(identity);
        }
    }
    if (listener != null) {
        try {
            listener.newClusterMetrics(getMetrics());
        } catch (Throwable t) {
            LOG.warn("LlapMetricsListener thrown an unexpected exception", t);
        }
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) LlapDaemonProtocolProtos(org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos) LlapManagementProtocolClientImpl(org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Map(java.util.Map) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

LlapManagementProtocolClientImpl (org.apache.hadoop.hive.llap.impl.LlapManagementProtocolClientImpl)5 InetSocketAddress (java.net.InetSocketAddress)2 HashMap (java.util.HashMap)2 Configuration (org.apache.hadoop.conf.Configuration)2 LlapDaemonConfiguration (org.apache.hadoop.hive.llap.configuration.LlapDaemonConfiguration)2 LlapDaemonExecutorMetrics (org.apache.hadoop.hive.llap.metrics.LlapDaemonExecutorMetrics)2 LlapManagementProtocolPB (org.apache.hadoop.hive.llap.protocol.LlapManagementProtocolPB)2 Test (org.junit.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ServiceException (com.google.protobuf.ServiceException)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ContainerRunner (org.apache.hadoop.hive.llap.daemon.ContainerRunner)1 LlapDaemonProtocolProtos (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos)1 GetDaemonMetricsResponseProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto)1 SetCapacityRequestProto (org.apache.hadoop.hive.llap.daemon.rpc.LlapDaemonProtocolProtos.SetCapacityRequestProto)1 LlapServiceInstance (org.apache.hadoop.hive.llap.registry.LlapServiceInstance)1 LlapZookeeperRegistryImpl (org.apache.hadoop.hive.llap.registry.impl.LlapZookeeperRegistryImpl)1