当前位置: 首页>>代码示例>>Java>>正文


Java RpcMetrics.getRpcSlowCalls方法代码示例

本文整理汇总了Java中org.apache.hadoop.ipc.metrics.RpcMetrics.getRpcSlowCalls方法的典型用法代码示例。如果您正苦于以下问题:Java RpcMetrics.getRpcSlowCalls方法的具体用法?Java RpcMetrics.getRpcSlowCalls怎么用?Java RpcMetrics.getRpcSlowCalls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.ipc.metrics.RpcMetrics的用法示例。


在下文中一共展示了RpcMetrics.getRpcSlowCalls方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLogSlowRPC

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入方法依赖的package包/类
@Test(timeout = 12000)
public void testLogSlowRPC() throws IOException, ServiceException {
  TestRpcService2 client = getClient2();
  // make 10 K fast calls
  for (int x = 0; x < 10000; x++) {
    try {
      client.ping2(null, newEmptyRequest());
    } catch (Exception ex) {
      throw ex;
    }
  }

  // Ensure RPC metrics are updated
  RpcMetrics rpcMetrics = server.getRpcMetrics();
  assertTrue(rpcMetrics.getProcessingSampleCount() > 999L);
  long before = rpcMetrics.getRpcSlowCalls();

  // make a really slow call. Sleep sleeps for 1000ms
  client.sleep(null, newSleepRequest(SLEEP_DURATION * 3));

  long after = rpcMetrics.getRpcSlowCalls();
  // Ensure slow call is logged.
  Assert.assertEquals(before + 1L, after);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:TestProtoBufRpc.java

示例2: testEnsureNoLogIfDisabled

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入方法依赖的package包/类
@Test(timeout = 12000)
public void testEnsureNoLogIfDisabled() throws IOException, ServiceException {
  // disable slow RPC  logging
  server.setLogSlowRPC(false);
  TestRpcService2 client = getClient2();

  // make 10 K fast calls
  for (int x = 0; x < 10000; x++) {
    client.ping2(null, newEmptyRequest());
  }

  // Ensure RPC metrics are updated
  RpcMetrics rpcMetrics = server.getRpcMetrics();
  assertTrue(rpcMetrics.getProcessingSampleCount() > 999L);
  long before = rpcMetrics.getRpcSlowCalls();

  // make a really slow call. Sleep sleeps for 1000ms
  client.sleep(null, newSleepRequest(SLEEP_DURATION));

  long after = rpcMetrics.getRpcSlowCalls();

  // make sure we never called into Log slow RPC routine.
  assertEquals(before, after);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:TestProtoBufRpc.java

示例3: testLogSlowRPC

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入方法依赖的package包/类
@Test(timeout = 12000)
public void testLogSlowRPC() throws IOException, ServiceException {
  TestRpcService2 client = getClient2();
  // make 10 K fast calls
  for (int x = 0; x < 10000; x++) {
    try {
      EmptyRequestProto emptyRequest = EmptyRequestProto.newBuilder().build();
      client.ping2(null, emptyRequest);
    } catch (Exception ex) {
      throw ex;
    }
  }

  // Ensure RPC metrics are updated
  RpcMetrics rpcMetrics = server.getRpcMetrics();
  assertTrue(rpcMetrics.getProcessingSampleCount() > 999L);
  long before = rpcMetrics.getRpcSlowCalls();

  // make a really slow call. Sleep sleeps for 1000ms
  TestProtos.SleepRequestProto sleepRequest =
      TestProtos.SleepRequestProto.newBuilder()
          .setMilliSeconds(SLEEP_DURATION * 3).build();
  TestProtos.SleepResponseProto Response = client.sleep(null, sleepRequest);

  long after = rpcMetrics.getRpcSlowCalls();
  // Ensure slow call is logged.
  Assert.assertEquals(before + 1L, after);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:29,代码来源:TestProtoBufRpc.java

示例4: testEnsureNoLogIfDisabled

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入方法依赖的package包/类
@Test(timeout = 12000)
public void testEnsureNoLogIfDisabled() throws IOException, ServiceException {
  // disable slow RPC  logging
  server.setLogSlowRPC(false);
  TestRpcService2 client = getClient2();

  // make 10 K fast calls
  for (int x = 0; x < 10000; x++) {
    EmptyRequestProto emptyRequest = EmptyRequestProto.newBuilder().build();
    client.ping2(null, emptyRequest);
  }

  // Ensure RPC metrics are updated
  RpcMetrics rpcMetrics = server.getRpcMetrics();
  assertTrue(rpcMetrics.getProcessingSampleCount() > 999L);
  long before = rpcMetrics.getRpcSlowCalls();

  // make a really slow call. Sleep sleeps for 1000ms
  TestProtos.SleepRequestProto sleepRequest =
      TestProtos.SleepRequestProto.newBuilder()
          .setMilliSeconds(SLEEP_DURATION).build();
  TestProtos.SleepResponseProto Response = client.sleep(null, sleepRequest);

  long after = rpcMetrics.getRpcSlowCalls();

  // make sure we never called into Log slow RPC routine.
  assertEquals(before, after);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:29,代码来源:TestProtoBufRpc.java


注:本文中的org.apache.hadoop.ipc.metrics.RpcMetrics.getRpcSlowCalls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。