|
|||||||||
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
Implementation of Resizer
that adjust the Pool
based on specified
thresholds.
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,
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<Routee> 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. |
static scala.Option<DefaultResizer> |
fromConfig(com.typesafe.config.Config resizerConfig)
|
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<Routee> 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. |
int |
resize(scala.collection.immutable.IndexedSeq<Routee> currentRoutees)
Decide if the capacity of the router need to be changed. |
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, int messagesPerResize)
public DefaultResizer(int lower, int upper)
Method Detail |
---|
public static DefaultResizer apply(com.typesafe.config.Config resizerConfig)
public static scala.Option<DefaultResizer> fromConfig(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 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 int resize(scala.collection.immutable.IndexedSeq<Routee> currentRoutees)
Resizer
isTimeForResize
returns true and no other resize is in progress.
Return the number of routees to add or remove. Negative value will remove that number of routees. Positive value will add that number of routess. 0 will not change the routees.
This method is invoked only in the context of the Router actor.
resize
in interface Resizer
public int capacity(scala.collection.immutable.IndexedSeq<Routee> routees)
routees
- The current actor in the resizer
public int pressure(scala.collection.immutable.IndexedSeq<Routee> 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 |