@InterfaceAudience.LimitedPrivate(value={"Coprocesssor","Phoenix"}) @InterfaceStability.Evolving public abstract class RpcExecutor extends Object
dispatch(CallRunner)
. Subclass and add particular
scheduling behavior.Modifier and Type | Class and Description |
---|---|
private static class |
RpcExecutor.CallPriorityComparator
Comparator used by the "normal callQueue" if DEADLINE_CALL_QUEUE_CONF_KEY is set to true.
|
Constructor and Description |
---|
RpcExecutor(String name,
int handlerCount,
int maxQueueLength,
PriorityFunction priority,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
RpcExecutor(String name,
int handlerCount,
String callQueueType,
int maxQueueLength,
PriorityFunction priority,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
protected int |
computeNumCallQueues(int handlerCount,
float callQueuesHandlersFactor) |
abstract boolean |
dispatch(CallRunner callTask)
Add the request to the executor queue
|
int |
getActiveHandlerCount() |
int |
getActiveReadHandlerCount() |
int |
getActiveScanHandlerCount() |
int |
getActiveWriteHandlerCount() |
static QueueBalancer |
getBalancer(String executorName,
org.apache.hadoop.conf.Configuration conf,
List<BlockingQueue<CallRunner>> queues) |
Map<String,Long> |
getCallQueueCountsSummary() |
Map<String,Long> |
getCallQueueSizeSummary() |
protected RpcHandler |
getHandler(String name,
double handlerFailureThreshhold,
int handlerCount,
BlockingQueue<CallRunner> q,
AtomicInteger activeHandlerCount,
AtomicInteger failedHandlerCount,
Abortable abortable)
Override if providing alternate Handler implementation.
|
private static String |
getMethodName(CallRunner callRunner)
Return the
Descriptors.MethodDescriptor#getName() from callRunner or "Unknown". |
String |
getName() |
long |
getNumGeneralCallsDropped() |
long |
getNumLifoModeSwitches() |
private Optional<Class<? extends BlockingQueue<CallRunner>>> |
getPluggableQueueClass() |
int |
getQueueLength()
Returns the length of the pending queue
|
protected List<BlockingQueue<CallRunner>> |
getQueues()
Returns the list of request queues
|
int |
getReadQueueLength() |
private static long |
getRpcCallSize(CallRunner callRunner)
Return the
RpcCall.getSize() from callRunner or 0L. |
int |
getScanQueueLength() |
int |
getWriteQueueLength() |
protected void |
initializeQueues(int numQueues) |
static boolean |
isCodelQueueType(String callQueueType) |
static boolean |
isDeadlineQueueType(String callQueueType) |
static boolean |
isFifoQueueType(String callQueueType) |
static boolean |
isPluggableQueueType(String callQueueType) |
static boolean |
isPluggableQueueWithFastPath(String callQueueType,
org.apache.hadoop.conf.Configuration conf) |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf) |
void |
resizeQueues(org.apache.hadoop.conf.Configuration conf)
Update current soft limit for executor's call queues
|
void |
start(int port) |
protected void |
startHandlers(int port) |
protected void |
startHandlers(String nameSuffix,
int numHandlers,
List<BlockingQueue<CallRunner>> callQueues,
int qindex,
int qsize,
int port,
AtomicInteger activeHandlerCount)
Start up our handlers.
|
void |
stop() |
private static final org.slf4j.Logger LOG
protected static final int DEFAULT_CALL_QUEUE_SIZE_HARD_LIMIT
public static final String CALL_QUEUE_HANDLER_FACTOR_CONF_KEY
public static final String QUEUE_MAX_CALL_DELAY_CONF_KEY
public static final String CALL_QUEUE_TYPE_CODEL_CONF_VALUE
public static final String CALL_QUEUE_TYPE_DEADLINE_CONF_VALUE
public static final String CALL_QUEUE_TYPE_FIFO_CONF_VALUE
public static final String CALL_QUEUE_TYPE_PLUGGABLE_CONF_VALUE
public static final String CALL_QUEUE_TYPE_CONF_KEY
public static final String CALL_QUEUE_TYPE_CONF_DEFAULT
public static final String CALL_QUEUE_QUEUE_BALANCER_CLASS
public static final Class<?> CALL_QUEUE_QUEUE_BALANCER_CLASS_DEFAULT
public static final String CALL_QUEUE_CODEL_TARGET_DELAY
public static final String CALL_QUEUE_CODEL_INTERVAL
public static final String CALL_QUEUE_CODEL_LIFO_THRESHOLD
public static final int CALL_QUEUE_CODEL_DEFAULT_TARGET_DELAY
public static final int CALL_QUEUE_CODEL_DEFAULT_INTERVAL
public static final double CALL_QUEUE_CODEL_DEFAULT_LIFO_THRESHOLD
public static final String PLUGGABLE_CALL_QUEUE_CLASS_NAME
public static final String PLUGGABLE_CALL_QUEUE_WITH_FAST_PATH_ENABLED
private final LongAdder numGeneralCallsDropped
private final LongAdder numLifoModeSwitches
protected final int numCallQueues
protected final List<BlockingQueue<CallRunner>> queues
private final Class<? extends BlockingQueue> queueClass
private final Object[] queueInitArgs
protected volatile int currentQueueLimit
private final AtomicInteger activeHandlerCount
private final List<RpcHandler> handlers
private final int handlerCount
private final AtomicInteger failedHandlerCount
private final org.apache.hadoop.conf.Configuration conf
private static final QueueBalancer ONE_QUEUE
public RpcExecutor(String name, int handlerCount, int maxQueueLength, PriorityFunction priority, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
public RpcExecutor(String name, int handlerCount, String callQueueType, int maxQueueLength, PriorityFunction priority, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
protected int computeNumCallQueues(int handlerCount, float callQueuesHandlersFactor)
private static String getMethodName(CallRunner callRunner)
Descriptors.MethodDescriptor#getName()
from callRunner
or "Unknown".private static long getRpcCallSize(CallRunner callRunner)
RpcCall.getSize()
from callRunner
or 0L.public Map<String,Long> getCallQueueCountsSummary()
public Map<String,Long> getCallQueueSizeSummary()
protected void initializeQueues(int numQueues)
public void start(int port)
public void stop()
public abstract boolean dispatch(CallRunner callTask)
protected List<BlockingQueue<CallRunner>> getQueues()
protected void startHandlers(int port)
protected RpcHandler getHandler(String name, double handlerFailureThreshhold, int handlerCount, BlockingQueue<CallRunner> q, AtomicInteger activeHandlerCount, AtomicInteger failedHandlerCount, Abortable abortable)
protected void startHandlers(String nameSuffix, int numHandlers, List<BlockingQueue<CallRunner>> callQueues, int qindex, int qsize, int port, AtomicInteger activeHandlerCount)
public static QueueBalancer getBalancer(String executorName, org.apache.hadoop.conf.Configuration conf, List<BlockingQueue<CallRunner>> queues)
public static boolean isDeadlineQueueType(String callQueueType)
public static boolean isCodelQueueType(String callQueueType)
public static boolean isFifoQueueType(String callQueueType)
public static boolean isPluggableQueueType(String callQueueType)
public static boolean isPluggableQueueWithFastPath(String callQueueType, org.apache.hadoop.conf.Configuration conf)
private Optional<Class<? extends BlockingQueue<CallRunner>>> getPluggableQueueClass()
public long getNumGeneralCallsDropped()
public long getNumLifoModeSwitches()
public int getActiveHandlerCount()
public int getActiveWriteHandlerCount()
public int getActiveReadHandlerCount()
public int getActiveScanHandlerCount()
public int getQueueLength()
public int getReadQueueLength()
public int getScanQueueLength()
public int getWriteQueueLength()
public void resizeQueues(org.apache.hadoop.conf.Configuration conf)
conf
- updated configurationpublic void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.