Class DefaultResizer
Implements
Inherited Members
Namespace: Akka.Routing
Assembly: Akka.dll
Syntax
public class DefaultResizer : Resizer, IEquatable<DefaultResizer>
Constructors
| Improve this Doc View SourceDefaultResizer(Int32, Int32, Int32, Double, Double, Double, Int32)
Initializes a new instance of the DefaultResizer class.
Declaration
public DefaultResizer(int lower, int upper, int pressureThreshold = 1, double rampupRate = 0.2, double backoffThreshold = 0.3, double backoffRate = 0.1, int messagesPerResize = 10)
Parameters
Type | Name | Description |
---|---|---|
Int32 | lower | TBD |
Int32 | upper | TBD |
Int32 | pressureThreshold | TBD |
Double | rampupRate | TBD |
Double | backoffThreshold | TBD |
Double | backoffRate | TBD |
Int32 | messagesPerResize | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | This exception can be thrown for a number of reasons. These include:
|
Properties
| Improve this Doc View SourceBackoffRate
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.
Declaration
public double BackoffRate { get; }
Property Value
Type | Description |
---|---|
Double |
BackoffThreshold
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.
Declaration
public double BackoffThreshold { get; }
Property Value
Type | Description |
---|---|
Double |
LowerBound
The fewest number of routees the router should ever have.
Declaration
public int LowerBound { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
MessagesPerResize
Number of messages between resize operation. Use 1 to resize before each message.
Declaration
public int MessagesPerResize { get; }
Property Value
Type | Description |
---|---|
Int32 |
PressureThreshold
- Threshold to evaluate if routee is considered to be busy (under pressure).
Implementation depends on this value (default is 1).
- 0: number of routees currently processing a message.
- 1: number of routees currently processing a message has some messages in mailbox.
- > 1: number of routees with at least the configured
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of default UnboundedMailbox is O(N) operation.
Declaration
public int PressureThreshold { get; }
Property Value
Type | Description |
---|---|
Int32 |
RampupRate
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.
Declaration
public double RampupRate { get; }
Property Value
Type | Description |
---|---|
Double |
UpperBound
The most number of routees the router should ever have.
Must be greater than or equal to lowerBound
.
Declaration
public int UpperBound { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceBackoff(Int32, Int32)
Computes a proposed negative (or zero) capacity delta using
the configured backoffThreshold
and backoffRate
Declaration
public int Backoff(int pressure, int capacity)
Parameters
Type | Name | Description |
---|---|---|
Int32 | pressure | pressure current number of busy routees |
Int32 | capacity | capacity current number of routees |
Returns
Type | Description |
---|---|
Int32 | proposed decrease in capacity (as a negative number) |
Capacity(IEnumerable<Routee>)
Returns the overall desired change in resizer capacity. Positive value will add routees to the resizer. Negative value will remove routees from the resizer
Declaration
public int Capacity(IEnumerable<Routee> currentRoutees)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Routee> | currentRoutees | The current actor in the resizer |
Returns
Type | Description |
---|---|
Int32 | the number of routees by which the resizer should be adjusted (positive, negative or zero) |
Equals(DefaultResizer)
Declaration
public bool Equals(DefaultResizer other)
Parameters
Type | Name | Description |
---|---|---|
DefaultResizer | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceFilter(Int32, Int32)
This method can be used to smooth the capacity delta by considering the current pressure and current capacity.
Declaration
public int Filter(int pressure, int capacity)
Parameters
Type | Name | Description |
---|---|---|
Int32 | pressure | pressure current number of busy routees |
Int32 | capacity | capacity current number of routees |
Returns
Type | Description |
---|---|
Int32 | proposed change in the capacity |
FromConfig(Config)
TBD
Declaration
public static DefaultResizer FromConfig(Config resizerConfig)
Parameters
Type | Name | Description |
---|---|---|
Config | resizerConfig | TBD |
Returns
Type | Description |
---|---|
DefaultResizer | TBD |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
| Improve this Doc View SourceIsTimeForResize(Int64)
TBD
Declaration
public override bool IsTimeForResize(long messageCounter)
Parameters
Type | Name | Description |
---|---|---|
Int64 | messageCounter | TBD |
Returns
Type | Description |
---|---|
Boolean | TBD |
Overrides
| Improve this Doc View SourcePressure(IEnumerable<Routee>)
Number of routees considered busy, or above 'pressure level'.
Implementation depends on the value of pressureThreshold
(default is 1).
- 0: number of routees currently processing a message.
- 1: number of routees currently processing a message has some messages in mailbox.
- > 1: number of routees with at least the configured
pressureThreshold
messages in their mailbox. Note that estimating mailbox size of default UnboundedMailbox is O(N) operation.
Declaration
public int Pressure(IEnumerable<Routee> currentRoutees)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Routee> | currentRoutees | An enumeration of the current routees |
Returns
Type | Description |
---|---|
Int32 | The number of routees considered to be above pressure level. |
Rampup(Int32, Int32)
Computes a proposed positive (or zero) capacity delta using
the configured rampupRate
.
Declaration
public int Rampup(int pressure, int capacity)
Parameters
Type | Name | Description |
---|---|---|
Int32 | pressure | the current number of busy routees |
Int32 | capacity | the current number of total routees |
Returns
Type | Description |
---|---|
Int32 | proposed increase in capacity |
Resize(IEnumerable<Routee>)
TBD
Declaration
public override int Resize(IEnumerable<Routee> currentRoutees)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Routee> | currentRoutees | TBD |
Returns
Type | Description |
---|---|
Int32 | TBD |