Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: heroku-devcent…
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 46 lines (42 sloc) 2.014 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
package com.typesafe.webwords.common

import akka.actor._
import akka.routing._

/**
* An actor pool with a bunch of reasonable defaults for actors
* that do some kind of blocking IO-bound work. General loose
* assumptions are that the requests to the actors are round-trips with
* replies (active futures), the actors won't use much CPU, that we only want
* to process each message one time, and that the actors in the pool could
* be expensive to create (e.g. establishing a network connection).
*
* A lot of the values set here are pretty arbitrary and could only
* be set scientifically with a lot of application-specific tuning.
*/
trait IOBoundActorPool
    extends DefaultActorPool
    with SmallestMailboxSelector
    with ActiveFuturesPressureCapacitor
    with BoundedCapacityStrategy
    with Filter
    with BasicRampup
    with BasicBackoff {
    self: Actor =>

    // Selector: selectionCount is how many pool members to send each message to
    override def selectionCount = 1
    // Selector: partialFill controls whether to pick less than selectionCount or
    // send the same message to duplicate delegates, when the pool is smaller
    // than selectionCount. Does not matter if lowerBound >= selectionCount.
    override def partialFill = true
    // BoundedCapacitor: create between lowerBound and upperBound delegates in the pool
    override val lowerBound = 1
    override lazy val upperBound = 50
    // BasicRampup: rampupRate is percentage increase in capacity when all delegates are busy
    // make this very small to aim for just 1 more actor per needed connection
    override def rampupRate = 0.05
    // BasicBackoff: backoffThreshold is the percentage-busy to drop below before
    // we reduce actor count
    override def backoffThreshold = 0.7
    // BasicBackoff: backoffRate is the amount to back off when we are below backoffThreshold.
    // this one is intended to be less than 1.0-backoffThreshold so we keep some slack.
    override def backoffRate = 0.20
}
Something went wrong with that request. Please try again.