public class DefaultResizer extends java.lang.Object implements Resizer, scala.Product, scala.Serializable
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
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() |
double |
backoffThreshold() |
abstract static boolean |
canEqual(java.lang.Object that) |
int |
capacity(scala.collection.immutable.IndexedSeq<Routee> routees)
Returns the overall desired change in resizer capacity.
|
abstract static boolean |
equals(java.lang.Object that) |
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() |
int |
messagesPerResize() |
int |
pressure(scala.collection.immutable.IndexedSeq<Routee> routees)
Number of routees considered busy, or above 'pressure level'.
|
int |
pressureThreshold() |
abstract static int |
productArity() |
abstract static java.lang.Object |
productElement(int n) |
static scala.collection.Iterator<java.lang.Object> |
productIterator() |
static java.lang.String |
productPrefix() |
int |
rampup(int pressure,
int capacity)
Computes a proposed positive (or zero) capacity delta using
the configured
rampupRate . |
double |
rampupRate() |
int |
resize(scala.collection.immutable.IndexedSeq<Routee> currentRoutees)
Decide if the capacity of the router need to be changed.
|
int |
upperBound() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DefaultResizer(int lowerBound, int upperBound, int pressureThreshold, double rampupRate, double backoffThreshold, double backoffRate, int messagesPerResize)
public DefaultResizer(int lower, int upper)
lower
- (undocumented)upper
- (undocumented)public static DefaultResizer apply(com.typesafe.config.Config resizerConfig)
resizerConfig
- (undocumented)public static scala.Option<DefaultResizer> fromConfig(com.typesafe.config.Config resizerConfig)
public abstract static boolean canEqual(java.lang.Object that)
public abstract static boolean equals(java.lang.Object that)
public abstract static java.lang.Object productElement(int n)
public abstract static int productArity()
public static scala.collection.Iterator<java.lang.Object> productIterator()
public static java.lang.String productPrefix()
public int lowerBound()
public int upperBound()
public int pressureThreshold()
public double rampupRate()
public double backoffThreshold()
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
messageCounter
- (undocumented)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 routees. 0 will not change the routees.
This method is invoked only in the context of the Router actor.
public int capacity(scala.collection.immutable.IndexedSeq<Routee> routees)
routees
- The current actor in the resizerpublic 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 routeespublic int filter(int pressure, int capacity)
pressure
- current number of busy routeescapacity
- current number of routeespublic int rampup(int pressure, int capacity)
rampupRate
.pressure
- the current number of busy routeescapacity
- the current number of total routeespublic int backoff(int pressure, int capacity)
backoffThreshold
and backoffRate
pressure
- the current number of busy routeescapacity
- the current number of total routees