org.apache.hadoop.hbase.ipc.PriorityFunction Java Examples

The following examples show how to use org.apache.hadoop.hbase.ipc.PriorityFunction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleRpcSchedulerFactory.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  int handlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
      HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT);
  return new SimpleRpcScheduler(
    conf,
    handlerCount,
    conf.getInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT,
      HConstants.DEFAULT_REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT),
    conf.getInt(HConstants.REGION_SERVER_REPLICATION_HANDLER_COUNT,
        HConstants.DEFAULT_REGION_SERVER_REPLICATION_HANDLER_COUNT),
      conf.getInt(HConstants.MASTER_META_TRANSITION_HANDLER_COUNT,
          HConstants.MASTER__META_TRANSITION_HANDLER_COUNT_DEFAULT),
    priority,
    server,
    HConstants.QOS_THRESHOLD);
}
 
Example #2
Source File: PhoenixIndexRpcSchedulerFactory.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priorityFunction, Abortable abortable) {
    // create the delegate scheduler
    RpcScheduler delegate;
    try {
        // happens in <=0.98.4 where the scheduler factory is not visible
        delegate = new SimpleRpcSchedulerFactory().create(conf, priorityFunction, abortable);
    } catch (IllegalAccessError e) {
        LOG.fatal(VERSION_TOO_OLD_FOR_INDEX_RPC);
        throw e;
    }

    int indexHandlerCount = conf.getInt(QueryServices.INDEX_HANDLER_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_HANDLER_COUNT);
    int minPriority = getMinPriority(conf);
    int maxPriority = conf.getInt(QueryServices.MAX_INDEX_PRIOIRTY_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_MAX_PRIORITY);
    // make sure the ranges are outside the warning ranges
    Preconditions.checkArgument(maxPriority > minPriority, "Max index priority (" + maxPriority
            + ") must be larger than min priority (" + minPriority + ")");
    boolean allSmaller =
            minPriority < HConstants.REPLICATION_QOS
                    && maxPriority < HConstants.REPLICATION_QOS;
    boolean allLarger = minPriority > HConstants.HIGH_QOS;
    Preconditions.checkArgument(allSmaller || allLarger, "Index priority range (" + minPriority
            + ",  " + maxPriority + ") must be outside HBase priority range ("
            + HConstants.REPLICATION_QOS + ", " + HConstants.HIGH_QOS + ")");

    LOG.info("Using custom Phoenix Index RPC Handling with " + indexHandlerCount
            + " handlers and priority range [" + minPriority + ", " + maxPriority + ")");

    PhoenixIndexRpcScheduler scheduler =
            new PhoenixIndexRpcScheduler(indexHandlerCount, conf, delegate, minPriority,
                    maxPriority);
    return scheduler;
}
 
Example #3
Source File: TestPhoenixIndexRpcSchedulerFactory.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priorityFunction, Abortable abortable) {
    PhoenixRpcScheduler phoenixIndexRpcScheduler = (PhoenixRpcScheduler)super.create(conf, priorityFunction, abortable);
    phoenixIndexRpcScheduler.setIndexExecutorForTesting(indexRpcExecutor);
    phoenixIndexRpcScheduler.setMetadataExecutorForTesting(metadataRpcExecutor);
    return phoenixIndexRpcScheduler;
}
 
Example #4
Source File: TestPriorityRpc.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testQosFunctionWithoutKnownArgument() throws IOException {
  //The request is not using any of the
  //known argument classes (it uses one random request class)
  //(known argument classes are listed in
  //HRegionServer.QosFunctionImpl.knownArgumentClasses)
  RequestHeader.Builder headerBuilder = RequestHeader.newBuilder();
  headerBuilder.setMethodName("foo");
  RequestHeader header = headerBuilder.build();
  PriorityFunction qosFunc = regionServer.rpcServices.getPriority();
  assertEquals(HConstants.NORMAL_QOS, qosFunc.getPriority(header, null, createSomeUser()));
}
 
Example #5
Source File: TestAsyncClientPauseForCallQueueTooBig.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  int handlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
    HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT);
  return new CQTBERpcScheduler(conf, handlerCount,
    conf.getInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT,
      HConstants.DEFAULT_REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT),
    conf.getInt(HConstants.REGION_SERVER_REPLICATION_HANDLER_COUNT,
      HConstants.DEFAULT_REGION_SERVER_REPLICATION_HANDLER_COUNT),
    conf.getInt(HConstants.MASTER_META_TRANSITION_HANDLER_COUNT,
      HConstants.MASTER__META_TRANSITION_HANDLER_COUNT_DEFAULT),
    priority, server, HConstants.QOS_THRESHOLD);
}
 
Example #6
Source File: MasterFifoRpcSchedulerFactory.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  int totalHandlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
    HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT);
  int rsReportHandlerCount = Math.max(1, conf
      .getInt(MasterFifoRpcScheduler.MASTER_SERVER_REPORT_HANDLER_COUNT, totalHandlerCount / 2));
  int callHandlerCount = Math.max(1, totalHandlerCount - rsReportHandlerCount);
  return new MasterFifoRpcScheduler(conf, callHandlerCount, rsReportHandlerCount);
}
 
Example #7
Source File: TestPhoenixIndexRpcSchedulerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public RpcScheduler create(Configuration configuration, PriorityFunction priorityFunction) {
    return create(configuration, priorityFunction, null);
}
 
Example #8
Source File: TestAsyncClientPauseForCallQueueTooBig.java    From hbase with Apache License 2.0 4 votes vote down vote up
public CQTBERpcScheduler(Configuration conf, int handlerCount, int priorityHandlerCount,
    int replicationHandlerCount, int metaTransitionHandler, PriorityFunction priority,
    Abortable server, int highPriorityLevel) {
  super(conf, handlerCount, priorityHandlerCount, replicationHandlerCount,
    metaTransitionHandler, priority, server, highPriorityLevel);
}
 
Example #9
Source File: TestMetaTableAccessor.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  final RpcScheduler delegate = super.create(conf, priority, server);
  return new SpyingRpcScheduler(delegate);
}
 
Example #10
Source File: RSRpcServices.java    From hbase with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public PriorityFunction getPriority() {
  return priority;
}
 
Example #11
Source File: RSRpcServices.java    From hbase with Apache License 2.0 4 votes vote down vote up
protected PriorityFunction createPriority() {
  return new AnnotationReadingPriorityFunction(this);
}
 
Example #12
Source File: FifoRpcSchedulerFactory.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Deprecated
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority) {
  return create(conf, priority, null);
}
 
Example #13
Source File: FifoRpcSchedulerFactory.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server) {
  int handlerCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
    HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT);
  return new FifoRpcScheduler(conf, handlerCount);
}
 
Example #14
Source File: SimpleRpcSchedulerFactory.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated since 1.0.0.
 * @see <a href="https://issues.apache.org/jira/browse/HBASE-12028">HBASE-12028</a>
 */
@Override
@Deprecated
public RpcScheduler create(Configuration conf, PriorityFunction priority) {
 return create(conf, priority, null);
}
 
Example #15
Source File: MasterRpcServices.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
protected PriorityFunction createPriority() {
  return new MasterAnnotationReadingPriorityFunction(this);
}
 
Example #16
Source File: PhoenixIndexRpcSchedulerFactory.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public RpcScheduler create(Configuration configuration, PriorityFunction priorityFunction) {
    return create(configuration, priorityFunction, null);
}
 
Example #17
Source File: RpcSchedulerFactory.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * @deprecated since 1.0.0.
 * @see <a href="https://issues.apache.org/jira/browse/HBASE-12028">HBASE-12028</a>
 */
@Deprecated
RpcScheduler create(Configuration conf, PriorityFunction priority);
 
Example #18
Source File: RpcSchedulerFactory.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a {@link org.apache.hadoop.hbase.ipc.RpcScheduler}.
 */
RpcScheduler create(Configuration conf, PriorityFunction priority, Abortable server);