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


Java RpcMetrics类代码示例

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


RpcMetrics类属于org.apache.hadoop.ipc.metrics包,在下文中一共展示了RpcMetrics类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

示例5: ConnectionSet

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
public ConnectionSet(String serverName, int numBuckets, RpcMetrics rpcMetrics) {
  if (Server.LOG.isDebugEnabled()) {
    Server.LOG.debug("Use " + numBuckets
        + " buckets for bucketizing connections of " + serverName);
  }
  this.numBuckets = numBuckets;
  connectionBuckets = new ConnectionBucket[numBuckets];
  this.rpcMetrics = rpcMetrics;
  this.serverName = serverName;
  for (int i = 0; i < connectionBuckets.length; i++) {
    connectionBuckets[i] = new ConnectionBucket();
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:ConnectionSet.java

示例6: Server

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
/** Constructs a server listening on the named port and address.  Parameters passed must
 * be of the named class.  The <code>handlerCount</handlerCount> determines
 * the number of handler threads that will be used to process calls.
 *
 */
protected Server(String bindAddress, int port,
                Class<? extends Writable> paramClass, int handlerCount,
                Configuration conf, String serverName)
  throws IOException {
  this.bindAddress = bindAddress;
  this.conf = conf;
  this.port = port;
  this.paramClass = paramClass;
  this.handlerCount = handlerCount;
  this.socketSendBufferSize = 0;
  this.maxQueueSize = handlerCount * conf.getInt(
                                 IPC_SERVER_HANDLER_QUEUE_SIZE_KEY,
                                 MAX_QUEUE_SIZE_PER_HANDLER);
  this.maxRespSize = conf.getInt(IPC_SERVER_RPC_MAX_RESPONSE_SIZE_KEY,
                                 IPC_SERVER_RPC_MAX_RESPONSE_SIZE_DEFAULT);
  this.readThreads = conf.getInt(IPC_SERVER_RPC_READ_THREADS_KEY,
                                 IPC_SERVER_RPC_READ_THREADS_DEFAULT);
  this.callQueue  = new LinkedBlockingQueue<Call>(maxQueueSize);
  this.maxIdleTime = 2*conf.getInt("ipc.client.connection.maxidletime", 1000);
  this.maxConnectionsToNuke = conf.getInt("ipc.client.kill.max", 10);
  this.thresholdIdleConnections = conf.getInt("ipc.client.idlethreshold", 4000);

  // Start the listener here and let it bind to the port
  listener = new Listener();
  this.port = listener.getAddress().getPort();
  this.rpcMetrics = new RpcMetrics(serverName,
                        Integer.toString(this.port), this);
  this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false);


  // Create the responder here
  responder = new Responder();
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:39,代码来源:Server.java

示例7: Server

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
/** Constructs a server listening on the named port and address.  Parameters passed must
 * be of the named class.  The <code>handlerCount</handlerCount> determines
 * the number of handler threads that will be used to process calls.
 * 
 */
protected Server(String bindAddress, int port, 
                Class<? extends Writable> paramClass, int handlerCount, 
                Configuration conf, String serverName) 
  throws IOException {
  this.bindAddress = bindAddress;
  this.conf = conf;
  this.port = port;
  this.paramClass = paramClass;
  this.handlerCount = handlerCount;
  this.socketSendBufferSize = 0;
  this.maxQueueSize = handlerCount * conf.getInt(
                              IPC_SERVER_HANDLER_QUEUE_SIZE_KEY,
                              IPC_SERVER_HANDLER_QUEUE_SIZE_DEFAULT);
  this.callQueue  = new LinkedBlockingQueue<Call>(maxQueueSize); 
  this.maxIdleTime = 2*conf.getInt("ipc.client.connection.maxidletime", 1000);
  this.maxConnectionsToNuke = conf.getInt("ipc.client.kill.max", 10);
  this.thresholdIdleConnections = conf.getInt("ipc.client.idlethreshold", 4000);
  
  // Start the listener here and let it bind to the port
  listener = new Listener();
  this.port = listener.getAddress().getPort();    
  this.rpcMetrics = new RpcMetrics(serverName,
                        Integer.toString(this.port), this);
  this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false);


  // Create the responder here
  responder = new Responder();
}
 
开发者ID:thisisvoa,项目名称:hadoop-0.20,代码行数:35,代码来源:Server.java

示例8: Server

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
/** Constructs a server listening on the named port and address.  Parameters passed must
 * be of the named class.  The <code>handlerCount</handlerCount> determines
 * the number of handler threads that will be used to process calls.
 * 
 */
protected Server(String bindAddress, int port, 
                Class<? extends Writable> paramClass, int handlerCount, 
                Configuration conf, String serverName) 
  throws IOException {
  this.bindAddress = bindAddress;
  this.conf = conf;
  this.port = port;
  this.paramClass = paramClass;
  this.handlerCount = handlerCount;
  this.socketSendBufferSize = 0;
  this.maxQueueSize = handlerCount * MAX_QUEUE_SIZE_PER_HANDLER;
  this.callQueue  = new LinkedBlockingQueue<Call>(maxQueueSize); 
  this.maxIdleTime = 2*conf.getInt("ipc.client.connection.maxidletime", 1000);
  this.maxConnectionsToNuke = conf.getInt("ipc.client.kill.max", 10);
  this.thresholdIdleConnections = conf.getInt("ipc.client.idlethreshold", 4000);
  
  // Start the listener here and let it bind to the port
  listener = new Listener();
  this.port = listener.getAddress().getPort();    
  this.rpcMetrics = new RpcMetrics(serverName,
                        Integer.toString(this.port), this);
  this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false);


  // Create the responder here
  responder = new Responder();
}
 
开发者ID:koichi626,项目名称:hadoop-gpu,代码行数:33,代码来源:Server.java

示例9: getRpcMetrics

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
/**
 * Returns a handle to the rpcMetrics (required in tests)
 * @return rpc metrics
 */
@VisibleForTesting
public RpcMetrics getRpcMetrics() {
  return rpcMetrics;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:Server.java

示例10: Server

import org.apache.hadoop.ipc.metrics.RpcMetrics; //导入依赖的package包/类
/** Constructs a server listening on the named port and address.  Parameters passed must
 * be of the named class.  The <code>handlerCount</handlerCount> determines
 * the number of handler threads that will be used to process calls.
 *
 */
protected Server(String bindAddress, int port,
                Class<? extends Writable> paramClass, int handlerCount,
                Configuration conf, String serverName, boolean supportOldJobConf)
  throws IOException {
  
  this.bindAddress = bindAddress;
  this.conf = conf;
  this.port = port;
  this.paramClass = paramClass;
  this.isInvocationClass = paramClass.equals(Invocation.class);
  this.directHandling = conf.getBoolean("ipc.direct.handling", false);
  
  if (directHandling) {
    LOG.info("Starting direct handler server");
    // reader threads are directly calling protocol methods
    this.handlerCount = 0;
    // make the direct buffer size bigger for faster reads
    NIO_BUFFER_LIMIT = 8 * NIO_BUFFER_LIMIT_BASE;
    // initial response buffer size must be at least the size
    // of max NIO_BUFFER_LIMIT (see channelIO())
    INITIAL_RESP_BUF_SIZE = NIO_BUFFER_LIMIT;
  } else {
    // reader threads populate callQueue, calls are executed by handlers
    this.handlerCount = handlerCount;
  }
  
  this.socketSendBufferSize = 0;
  this.maxQueueSize = handlerCount * conf.getInt(
                                 IPC_SERVER_HANDLER_QUEUE_SIZE_KEY,
                                 MAX_QUEUE_SIZE_PER_HANDLER);
  this.maxRespSize = conf.getInt(IPC_SERVER_RPC_MAX_RESPONSE_SIZE_KEY,
                                 IPC_SERVER_RPC_MAX_RESPONSE_SIZE_DEFAULT);
  this.readThreads = conf.getInt(IPC_SERVER_RPC_READ_THREADS_KEY,
                                 IPC_SERVER_RPC_READ_THREADS_DEFAULT);
  this.supportOldJobConf = supportOldJobConf;
  conf.setBoolean("rpc.support.jobconf", supportOldJobConf);
  this.callQueue  = new ArrayBlockingQueue<Call>(maxQueueSize);
  this.maxIdleTime = 2*conf.getInt(IPC_SERVER_CLIENT_CONN_MAXIDLETIME, 1000);
  this.thresholdIdleConnections = conf.getInt(IPC_SERVER_CLIENT_IDLETHRESHOLD, 4000);

  // Start the listener here and let it bind to the port
  listener = new Listener();
  this.port = listener.getAddress().getPort();
  this.rpcMetrics = new RpcMetrics(serverName,
                        Integer.toString(this.port), this);
  // For now, we use readThreads*4 as connection bucket numbers for simplicity.
  this.connectionSet = new ConnectionSet(getIpcServerName(), readThreads * 4,
      rpcMetrics);
  this.tcpNoDelay = conf.getBoolean("ipc.server.tcpnodelay", false);
  this.pollingInterval = conf.getLong("rpc.polling.interval", 1000);

  // Create the responder here
  responder = new Responder();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:60,代码来源:Server.java


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