Package org.apache.hadoop.ipc
Class WeightedTimeCostProvider
java.lang.Object
org.apache.hadoop.ipc.WeightedTimeCostProvider
- All Implemented Interfaces:
CostProvider
A
CostProvider that calculates the cost for an operation
as a weighted sum of its processing time values (see
ProcessingDetails). This can be used by specifying the
CommonConfigurationKeys.IPC_COST_PROVIDER_KEY
configuration key.
This allows for configuration of how heavily each of the operations
within ProcessingDetails is weighted. By default,
ProcessingDetails.Timing.LOCKFREE,
ProcessingDetails.Timing.RESPONSE, and
ProcessingDetails.Timing.HANDLER times have a weight of
1,
ProcessingDetails.Timing.LOCKSHARED has a weight of
10,
ProcessingDetails.Timing.LOCKEXCLUSIVE has a weight of
100, and others are ignored.
These values can all be configured using the WEIGHT_CONFIG_PREFIX
key, prefixed with the IPC namespace, and suffixed with the name of the
timing measurement from ProcessingDetails (all lowercase).
For example, to set the lock exclusive weight to be 1000, set:
ipc.8020.cost-provider.impl=org.apache.hadoop.ipc.WeightedTimeCostProvider ipc.8020.weighted-cost.lockexclusive=1000
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe prefix used in configuration values specifying the weight to use when determining the cost of an operation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetCost(ProcessingDetails details) Calculates a weighted sum of the times stored on the provided processing details to be used as the cost inDecayRpcScheduler.voidinit(String namespace, Configuration conf) Initialize this provider using the given configuration, examining only ones which fall within the provided namespace.
-
Field Details
-
WEIGHT_CONFIG_PREFIX
The prefix used in configuration values specifying the weight to use when determining the cost of an operation. See the class Javadoc for more info.- See Also:
-
-
Constructor Details
-
WeightedTimeCostProvider
public WeightedTimeCostProvider()
-
-
Method Details
-
init
Description copied from interface:CostProviderInitialize this provider using the given configuration, examining only ones which fall within the provided namespace.- Specified by:
initin interfaceCostProvider- Parameters:
namespace- The namespace to use when looking up configurations.conf- The configuration
-
getCost
Calculates a weighted sum of the times stored on the provided processing details to be used as the cost inDecayRpcScheduler.- Specified by:
getCostin interfaceCostProvider- Parameters:
details- Processing details- Returns:
- The weighted sum of the times. The returned unit is the same as the default unit used by the provided processing details.
-