Package org.apache.hadoop.ipc
Class DecayRpcScheduler
java.lang.Object
org.apache.hadoop.ipc.DecayRpcScheduler
- All Implemented Interfaces:
DecayRpcSchedulerMXBean,RpcScheduler,MetricsSource
public class DecayRpcScheduler
extends Object
implements RpcScheduler, DecayRpcSchedulerMXBean, MetricsSource
The decay RPC scheduler tracks the cost of incoming requests in a map, then
decays the costs at a fixed time interval. The scheduler is optimized
for large periods (on the order of seconds), as it offloads work to the
decay sweep.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis TimerTask will call decayCurrentCosts until the scheduler has been garbage collected.static final classMetricsProxy is a singleton because we may init multiple schedulers and we want to clean up resources when a new scheduler replaces the old one. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final Stringstatic final Booleanstatic final Stringstatic final Stringstatic final StringService users will always be scheduled into the highest-priority queue.static final StringThresholds are specified as integer percentages, and specify which usage range each queue will be allocated to.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final doublestatic final StringDecay factor controls how much each cost is suppressed by on each sweep.static final longstatic final StringPeriod controls how many milliseconds between each decay sweep.static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionDecayRpcScheduler(int numLevels, String ns, Configuration conf) Create a decay scheduler. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResponseTime(String callName, Schedulable schedulable, ProcessingDetails details) Store a processing time value for an RPC call into this scheduler.double[]voidgetMetrics(MetricsCollector collector, boolean all) Get metrics from the metrics sourceintCompute the appropriate priority for a schedulable based on past requests.long[]longlonglonglongintbooleanshouldBackOff(Schedulable obj) voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.ipc.RpcScheduler
addResponseTime
-
Field Details
-
IPC_SCHEDULER_DECAYSCHEDULER_PERIOD_KEY
Period controls how many milliseconds between each decay sweep.- See Also:
-
IPC_SCHEDULER_DECAYSCHEDULER_PERIOD_DEFAULT
public static final long IPC_SCHEDULER_DECAYSCHEDULER_PERIOD_DEFAULT- See Also:
-
IPC_FCQ_DECAYSCHEDULER_PERIOD_KEY
Deprecated.- See Also:
-
IPC_SCHEDULER_DECAYSCHEDULER_FACTOR_KEY
Decay factor controls how much each cost is suppressed by on each sweep. Valid numbers are > 0 and < 1. Decay factor works in tandem with period to control how long the scheduler remembers an identity.- See Also:
-
IPC_SCHEDULER_DECAYSCHEDULER_FACTOR_DEFAULT
public static final double IPC_SCHEDULER_DECAYSCHEDULER_FACTOR_DEFAULT- See Also:
-
IPC_FCQ_DECAYSCHEDULER_FACTOR_KEY
Deprecated.- See Also:
-
IPC_DECAYSCHEDULER_THRESHOLDS_KEY
Thresholds are specified as integer percentages, and specify which usage range each queue will be allocated to. For instance, specifying the list 10, 40, 80 implies 4 queues, with - q3 from 80% up - q2 from 40 up to 80 - q1 from 10 up to 40 - q0 otherwise.- See Also:
-
IPC_FCQ_DECAYSCHEDULER_THRESHOLDS_KEY
Deprecated.- See Also:
-
IPC_DECAYSCHEDULER_SERVICE_USERS_KEY
Service users will always be scheduled into the highest-priority queue. They are specified as a comma-separated list.- See Also:
-
DECAYSCHEDULER_UNKNOWN_IDENTITY
- See Also:
-
IPC_DECAYSCHEDULER_BACKOFF_RESPONSETIME_ENABLE_KEY
- See Also:
-
IPC_DECAYSCHEDULER_BACKOFF_RESPONSETIME_ENABLE_DEFAULT
-
IPC_DECAYSCHEDULER_BACKOFF_RESPONSETIME_THRESHOLDS_KEY
- See Also:
-
DECAYSCHEDULER_METRICS_TOP_USER_COUNT
- See Also:
-
DECAYSCHEDULER_METRICS_TOP_USER_COUNT_DEFAULT
public static final int DECAYSCHEDULER_METRICS_TOP_USER_COUNT_DEFAULT- See Also:
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
DecayRpcScheduler
Create a decay scheduler.- Parameters:
numLevels- number of priority levelsns- config prefix, so that we can configure multiple schedulers in a single instance.conf- configuration to use.
-
-
Method Details
-
getPriorityLevel
Compute the appropriate priority for a schedulable based on past requests.- Specified by:
getPriorityLevelin interfaceRpcScheduler- Parameters:
obj- the schedulable obj to query and remember- Returns:
- the level index which we recommend scheduling in
-
shouldBackOff
- Specified by:
shouldBackOffin interfaceRpcScheduler
-
addResponseTime
Description copied from interface:RpcSchedulerStore a processing time value for an RPC call into this scheduler.- Specified by:
addResponseTimein interfaceRpcScheduler- Parameters:
callName- The name of the call.schedulable- The schedulable representing the incoming call.details- The details of processing time.
-
getUniqueIdentityCount
public int getUniqueIdentityCount()- Specified by:
getUniqueIdentityCountin interfaceDecayRpcSchedulerMXBean
-
getTotalCallVolume
public long getTotalCallVolume()- Specified by:
getTotalCallVolumein interfaceDecayRpcSchedulerMXBean
-
getTotalRawCallVolume
public long getTotalRawCallVolume() -
getTotalServiceUserCallVolume
public long getTotalServiceUserCallVolume() -
getTotalServiceUserRawCallVolume
public long getTotalServiceUserRawCallVolume() -
getResponseTimeCountInLastWindow
public long[] getResponseTimeCountInLastWindow()- Specified by:
getResponseTimeCountInLastWindowin interfaceDecayRpcSchedulerMXBean
-
getAverageResponseTime
public double[] getAverageResponseTime()- Specified by:
getAverageResponseTimein interfaceDecayRpcSchedulerMXBean
-
getMetrics
Description copied from interface:MetricsSourceGet metrics from the metrics source- Specified by:
getMetricsin interfaceMetricsSource- Parameters:
collector- to contain the resulting metrics snapshotall- if true, return all metrics even if unchanged.
-
getSchedulingDecisionSummary
- Specified by:
getSchedulingDecisionSummaryin interfaceDecayRpcSchedulerMXBean
-
getCallVolumeSummary
- Specified by:
getCallVolumeSummaryin interfaceDecayRpcSchedulerMXBean
-
getDecayRpcSchedulerDetailedMetrics
-
stop
public void stop()- Specified by:
stopin interfaceRpcScheduler
-