public class ContentionStrategy
extends java.lang.Object
A strategy for making back-off decisions for Paxos operations that fail to make progress because of other paxos operations. The strategy is defined by four factors:
The first three represent time periods, and may be defined dynamically based on a simple calculation over:
pX()
recent experienced latency distribution for successful operations,
e.g. p50(rw)
the maximum of read and write median latencies,
p999(r)
the 99.9th percentile of read latencies
attempts
the number of failed attempts made by the operation so far
constant
a user provided floating point constant
Their calculation may take any of these forms
$constant$[mu]s
pX() * constant
pX() * constant * attempts
pX() * constant ^ attempts
Furthermore, the dynamic calculations can be bounded with a min/max, like so:
min[mu]s <= dynamic expr <= max[mu]s
e.g.
10ms <= p50(rw)*0.66
10ms <= p95(rw)*1.8^attempts <= 100ms
5ms <= p50(rw)*0.5
These calculations are put together to construct a range from which we draw a random number.
The period we wait for X
will be drawn so that min <= X < max
.
With the constraint that max
must be minDelta
greater than min
,
but no greater than its expression-defined maximum. max
will be increased up until
this point, after which min
will be decreased until this gap is imposed.
The waitRandomizer
property specifies the manner in which a random value is drawn from the range.
It is defined using one of the following specifiers:
attempts
buckets, then applies the pure
exponential approach to draw values from [0..attempts), before drawing a uniform value from the corresponding bucket
Finally, there is also a traceAfterAttempts
property that permits initiating tracing of operations
that experience a certain minimum number of failed paxos rounds due to contention. A setting of 0 or 1 will initiate
a trace session after the first failed ballot.
Modifier and Type | Class and Description |
---|---|
static class |
ContentionStrategy.Type |
Constructor and Description |
---|
ContentionStrategy(java.lang.String waitRandomizer,
java.lang.String min,
java.lang.String max,
java.lang.String minDelta,
int traceAfterAttempts) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getStrategySpec() |
static void |
setStrategy(java.lang.String spec) |
Copyright © 2009- The Apache Software Foundation