Class/Object

akka.routing

DefaultResizer

Related Docs: object DefaultResizer | package routing

Permalink

case class DefaultResizer(lowerBound: Int = 1, upperBound: Int = 10, pressureThreshold: Int = 1, rampupRate: Double = 0.2, backoffThreshold: Double = 0.3, backoffRate: Double = 0.1, messagesPerResize: Int = 10) extends Resizer with Product with Serializable

Implementation of Resizer that adjust the Pool based on specified thresholds.

lowerBound

The fewest number of routees the router should ever have.

upperBound

The most number of routees the router should ever have. Must be greater than or equal to lowerBound.

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.
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.

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.

backoffRate

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.

messagesPerResize

Number of messages between resize operation. Use 1 to resize before each message.

Annotations
@SerialVersionUID()
Source
Resizer.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, Resizer, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultResizer
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Resizer
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DefaultResizer(lower: Int, upper: Int)

    Permalink

    Java API constructor for default values except bounds.

  2. new DefaultResizer(lowerBound: Int = 1, upperBound: Int = 10, pressureThreshold: Int = 1, rampupRate: Double = 0.2, backoffThreshold: Double = 0.3, backoffRate: Double = 0.1, messagesPerResize: Int = 10)

    Permalink

    lowerBound

    The fewest number of routees the router should ever have.

    upperBound

    The most number of routees the router should ever have. Must be greater than or equal to lowerBound.

    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.
    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.

    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.

    backoffRate

    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.

    messagesPerResize

    Number of messages between resize operation. Use 1 to resize before each message.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to any2stringadd[DefaultResizer] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (DefaultResizer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to ArrowAssoc[DefaultResizer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def backoff(pressure: Int, capacity: Int): Int

    Permalink

    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

    pressure

    the current number of busy routees

    capacity

    the current number of total routees

    returns

    proposed decrease in capacity (as a negative number)

  8. val backoffRate: Double

    Permalink

    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.

  9. val backoffThreshold: Double

    Permalink

    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.

  10. def capacity(routees: IndexedSeq[Routee]): Int

    Permalink

    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.

    routees

    The current actor in the resizer

    returns

    the number of routees by which the resizer should be adjusted (positive, negative or zero)

  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def ensuring(cond: (DefaultResizer) ⇒ Boolean, msg: ⇒ Any): DefaultResizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to Ensuring[DefaultResizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (DefaultResizer) ⇒ Boolean): DefaultResizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to Ensuring[DefaultResizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: ⇒ Any): DefaultResizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to Ensuring[DefaultResizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): DefaultResizer

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to Ensuring[DefaultResizer] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def filter(pressure: Int, capacity: Int): Int

    Permalink

    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.

    pressure

    current number of busy routees

    capacity

    current number of routees

    returns

    proposed change in the capacity

  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to StringFormat[DefaultResizer] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  20. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. def isTimeForResize(messageCounter: Long): Boolean

    Permalink

    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.

    Definition Classes
    DefaultResizerResizer
  23. val lowerBound: Int

    Permalink

    The fewest number of routees the router should ever have.

  24. val messagesPerResize: Int

    Permalink

    Number of messages between resize operation.

    Number of messages between resize operation. Use 1 to resize before each message.

  25. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. def pressure(routees: IndexedSeq[Routee]): Int

    Permalink

    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).

    • 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.
    routees

    the current resizer of routees

    returns

    number of busy routees, between 0 and routees.size

  29. val pressureThreshold: Int

    Permalink

    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).

    • 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.
  30. def rampup(pressure: Int, capacity: Int): Int

    Permalink

    Computes a proposed positive (or zero) capacity delta using the configured rampupRate.

    Computes a proposed positive (or zero) capacity delta using the configured rampupRate.

    pressure

    the current number of busy routees

    capacity

    the current number of total routees

    returns

    proposed increase in capacity

  31. val rampupRate: Double

    Permalink

    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.

  32. def resize(currentRoutees: IndexedSeq[Routee]): Int

    Permalink

    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.

    Definition Classes
    DefaultResizerResizer
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. val upperBound: Int

    Permalink

    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.

  35. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. def [B](y: B): (DefaultResizer, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from DefaultResizer to ArrowAssoc[DefaultResizer] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Resizer

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from DefaultResizer to any2stringadd[DefaultResizer]

Inherited by implicit conversion StringFormat from DefaultResizer to StringFormat[DefaultResizer]

Inherited by implicit conversion Ensuring from DefaultResizer to Ensuring[DefaultResizer]

Inherited by implicit conversion ArrowAssoc from DefaultResizer to ArrowAssoc[DefaultResizer]

Ungrouped