CostProviderpublic class WeightedTimeCostProvider extends java.lang.Object implements CostProvider
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
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
WEIGHT_CONFIG_PREFIX |
The prefix used in configuration values specifying the weight to use when
determining the cost of an operation.
|
| Constructor | Description |
|---|---|
WeightedTimeCostProvider() |
| Modifier and Type | Method | Description |
|---|---|---|
long |
getCost(ProcessingDetails details) |
Calculates a weighted sum of the times stored on the provided processing
details to be used as the cost in
DecayRpcScheduler. |
void |
init(java.lang.String namespace,
Configuration conf) |
Initialize this provider using the given configuration, examining only
ones which fall within the provided namespace.
|
public static final java.lang.String WEIGHT_CONFIG_PREFIX
public void init(java.lang.String namespace,
Configuration conf)
CostProviderinit in interface CostProvidernamespace - The namespace to use when looking up configurations.conf - The configurationpublic long getCost(ProcessingDetails details)
DecayRpcScheduler.getCost in interface CostProviderdetails - Processing detailsCopyright © 2008–2025 Apache Software Foundation. All rights reserved.