Java API constructor for default values except bounds.
The fewest number of routees the router should ever have.
The most number of routees the router should ever have. Must be greater than or equal to lowerBound
.
Threshold to evaluate if routee is considered to be busy (under pressure). Implementation depends on this value (default is 1).
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of
default UnboundedMailbox is O(N) operation.Percentage to increase capacity whenever all routees are busy. For example, 0.2 would increase 20% (rounded up), i.e. if current capacity is 6 it will request an increase of 2 more routees.
Minimum fraction of busy routees before backing off. For example, if this is 0.3, then we'll remove some routees only when less than 30% of routees are busy, i.e. if current capacity is 10 and 3 are busy then the capacity is unchanged, but if 2 or less are busy the capacity is decreased. Use 0.0 or negative to avoid removal of routees.
Fraction of routees to be removed when the resizer reaches the backoffThreshold. For example, 0.1 would decrease 10% (rounded up), i.e. if current capacity is 9 it will request an decrease of 1 routee.
Number of messages between resize operation. Use 1 to resize before each message.
Computes a proposed negative (or zero) capacity delta using
the configured backoffThreshold
and backoffRate
Computes a proposed negative (or zero) capacity delta using
the configured backoffThreshold
and backoffRate
the current number of busy routees
the current number of total routees
proposed decrease in capacity (as a negative number)
Fraction of routees to be removed when the resizer reaches the backoffThreshold.
Fraction of routees to be removed when the resizer reaches the backoffThreshold. For example, 0.1 would decrease 10% (rounded up), i.e. if current capacity is 9 it will request an decrease of 1 routee.
Minimum fraction of busy routees before backing off.
Minimum fraction of busy routees before backing off. For example, if this is 0.3, then we'll remove some routees only when less than 30% of routees are busy, i.e. if current capacity is 10 and 3 are busy then the capacity is unchanged, but if 2 or less are busy the capacity is decreased. Use 0.0 or negative to avoid removal of routees.
Returns the overall desired change in resizer capacity.
Returns the overall desired change in resizer capacity. Positive value will add routees to the resizer. Negative value will remove routees from the resizer.
The current actor in the resizer
the number of routees by which the resizer should be adjusted (positive, negative or zero)
This method can be used to smooth the capacity delta by considering the current pressure and current capacity.
This method can be used to smooth the capacity delta by considering the current pressure and current capacity.
current number of busy routees
current number of routees
proposed change in the capacity
Is it time for resizing.
Is it time for resizing. Typically implemented with modulo of nth message, but could be based on elapsed time or something else. The messageCounter starts with 0 for the initial resize and continues with 1 for the first message. Make sure to perform initial resize before first message (messageCounter == 0), because there is no guarantee that resize will be done when concurrent messages are in play.
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.
The fewest number of routees the router should ever have.
Number of messages between resize operation.
Number of messages between resize operation. Use 1 to resize before each message.
Number of routees considered busy, or above 'pressure level'.
Number of routees considered busy, or above 'pressure level'.
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.the current resizer of routees
number of busy routees, between 0 and routees.size
Threshold to evaluate if routee is considered to be busy (under pressure).
Threshold to evaluate if routee is considered to be busy (under pressure). Implementation depends on this value (default is 1).
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of
default UnboundedMailbox is O(N) operation.Computes a proposed positive (or zero) capacity delta using
the configured rampupRate
.
Computes a proposed positive (or zero) capacity delta using
the configured rampupRate
.
the current number of busy routees
the current number of total routees
proposed increase in capacity
Percentage to increase capacity whenever all routees are busy.
Percentage to increase capacity whenever all routees are busy. For example, 0.2 would increase 20% (rounded up), i.e. if current capacity is 6 it will request an increase of 2 more routees.
Decide if the capacity of the router need to be changed.
Decide if the capacity of the router need to be changed. Will be invoked when 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.
The most number of routees the router should ever have.
The most number of routees the router should ever have. Must be greater than or equal to lowerBound
.
Implementation of Resizer that adjust the Pool based on specified thresholds.
The fewest number of routees the router should ever have.
The most number of routees the router should ever have. Must be greater than or equal to
lowerBound
.Threshold to evaluate if routee is considered to be busy (under pressure). Implementation depends on this value (default is 1).
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of default UnboundedMailbox is O(N) operation.Percentage to increase capacity whenever all routees are busy. For example, 0.2 would increase 20% (rounded up), i.e. if current capacity is 6 it will request an increase of 2 more routees.
Minimum fraction of busy routees before backing off. For example, if this is 0.3, then we'll remove some routees only when less than 30% of routees are busy, i.e. if current capacity is 10 and 3 are busy then the capacity is unchanged, but if 2 or less are busy the capacity is decreased. Use 0.0 or negative to avoid removal of routees.
Fraction of routees to be removed when the resizer reaches the backoffThreshold. For example, 0.1 would decrease 10% (rounded up), i.e. if current capacity is 9 it will request an decrease of 1 routee.
Number of messages between resize operation. Use 1 to resize before each message.