|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.routing.DefaultResizer
public class DefaultResizer
Creates a new DefaultResizer from the given configuration
Constructor Summary | |
---|---|
DefaultResizer(int lower,
int upper)
Java API constructor for default values except bounds. |
|
DefaultResizer(int lowerBound,
int upperBound,
int pressureThreshold,
double rampupRate,
double backoffThreshold,
double backoffRate,
scala.concurrent.duration.FiniteDuration stopDelay,
int messagesPerResize)
|
Method Summary | |
---|---|
static DefaultResizer |
apply(com.typesafe.config.Config resizerConfig)
Creates a new DefaultResizer from the given configuration |
int |
backoff(int pressure,
int capacity)
Computes a proposed negative (or zero) capacity delta using the configured backoffThreshold and backoffRate |
double |
backoffRate()
Fraction of routees to be removed when the resizer reaches the backoffThreshold. |
double |
backoffThreshold()
Minimum fraction of busy routees before backing off. |
int |
capacity(scala.collection.immutable.IndexedSeq<ActorRef> routees)
Returns the overall desired change in resizer capacity. |
int |
filter(int pressure,
int capacity)
This method can be used to smooth the capacity delta by considering the current pressure and current capacity. |
boolean |
isTimeForResize(long messageCounter)
Is it time for resizing. |
int |
lowerBound()
The fewest number of routees the router should ever have. |
int |
messagesPerResize()
Number of messages between resize operation. |
int |
pressure(scala.collection.immutable.IndexedSeq<ActorRef> routees)
Number of routees considered busy, or above 'pressure level'. |
int |
pressureThreshold()
Threshold to evaluate if routee is considered to be busy (under pressure). |
int |
rampup(int pressure,
int capacity)
Computes a proposed positive (or zero) capacity delta using the configured rampupRate . |
double |
rampupRate()
Percentage to increase capacity whenever all routees are busy. |
void |
resize(RouteeProvider routeeProvider)
Decide if the capacity of the router need to be changed. |
scala.concurrent.duration.FiniteDuration |
stopDelay()
When the resizer reduce the capacity the abandoned routee actors are stopped with PoisonPill after this delay. |
int |
upperBound()
The most number of routees the router should ever have. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface scala.Product |
---|
productArity, productElement, productIterator, productPrefix |
Methods inherited from interface scala.Equals |
---|
canEqual, equals |
Constructor Detail |
---|
public DefaultResizer(int lowerBound, int upperBound, int pressureThreshold, double rampupRate, double backoffThreshold, double backoffRate, scala.concurrent.duration.FiniteDuration stopDelay, int messagesPerResize)
public DefaultResizer(int lower, int upper)
Method Detail |
---|
public static DefaultResizer apply(com.typesafe.config.Config resizerConfig)
public int lowerBound()
public int upperBound()
lowerBound
.
public int pressureThreshold()
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of
default UnboundedMailbox is O(N) operation.
public double rampupRate()
public double backoffThreshold()
Use 0.0 or negative to avoid removal of routees.
public double backoffRate()
public scala.concurrent.duration.FiniteDuration stopDelay()
public int messagesPerResize()
public boolean isTimeForResize(long messageCounter)
Resizer
CAUTION: this method is invoked from the thread which tries to send a message to the pool, i.e. the ActorRef.!() method, hence it may be called concurrently.
isTimeForResize
in interface Resizer
public void resize(RouteeProvider routeeProvider)
Resizer
isTimeForResize
returns true and no other resize is in progress.
Create and register more routees with routeeProvider.registerRoutees(newRoutees)
or remove routees with
routeeProvider.unregisterRoutees(abandonedRoutees) and
sending PoisonPill
to them.
This method is invoked only in the context of the Router actor in order to safely create/stop children.
resize
in interface Resizer
public int capacity(scala.collection.immutable.IndexedSeq<ActorRef> routees)
routees
- The current actor in the resizer
public int pressure(scala.collection.immutable.IndexedSeq<ActorRef> routees)
Implementation depends on the value of pressureThreshold
(default is 1).
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of
default UnboundedMailbox is O(N) operation.
routees
- the current resizer of routees
public int filter(int pressure, int capacity)
pressure
- current number of busy routeescapacity
- current number of routees
public int rampup(int pressure, int capacity)
rampupRate
.
pressure
- the current number of busy routeescapacity
- the current number of total routees
public int backoff(int pressure, int capacity)
backoffThreshold
and backoffRate
pressure
- the current number of busy routeescapacity
- the current number of total routees
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |