Class TailChoppingRoutingLogic
- All Implemented Interfaces:
Serializable
,NoSerializationVerificationNeeded
,RoutingLogic
,scala.Equals
,scala.Product
interval
has passed, the same message is sent
to the next routee. This process repeats until either a response is received from some routee, the
routees in the pool are exhausted, or the within
duration has passed since the first send. If no
routee sends a response in time, a pekko.actor.Status.Failure
wrapping a pekko.pattern.AskTimeoutException
is sent to the sender.
The goal of this routing algorithm is to decrease tail latencies ("chop off the tail latency") in situations where multiple routees can perform the same piece of work, and where a routee may occasionally respond more slowly than expected. In this case, sending the same work request (also known as a "backup request") to another actor results in decreased response time - because it's less probable that multiple actors are under heavy load simultaneously. This technique is explained in depth in Jeff Dean's presentation on Achieving Rapid Response Times in Large Online Services.
param: scheduler schedules sending messages to routees
param: within expecting at least one reply within this duration, otherwise
it will reply with pekko.pattern.AskTimeoutException
in a pekko.actor.Status.Failure
param: interval duration after which the message will be sent to the next routee
param: context execution context used by scheduler
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTailChoppingRoutingLogic
(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context) -
Method Summary
Modifier and TypeMethodDescriptionstatic TailChoppingRoutingLogic
apply
(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context) boolean
scala.concurrent.ExecutionContext
context()
copy
(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context) scala.concurrent.duration.FiniteDuration
scala.concurrent.duration.FiniteDuration
scala.concurrent.ExecutionContext
boolean
int
hashCode()
scala.concurrent.duration.FiniteDuration
interval()
int
productElement
(int x$1) productElementName
(int x$1) scala.collection.Iterator<Object>
Pick the destination for a given message.toString()
static scala.Option<scala.Tuple4<Scheduler,
scala.concurrent.duration.FiniteDuration, scala.concurrent.duration.FiniteDuration, scala.concurrent.ExecutionContext>> scala.concurrent.duration.FiniteDuration
within()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface scala.Product
productElementNames
-
Constructor Details
-
TailChoppingRoutingLogic
public TailChoppingRoutingLogic(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context)
-
-
Method Details
-
apply
public static TailChoppingRoutingLogic apply(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context) -
unapply
public static scala.Option<scala.Tuple4<Scheduler,scala.concurrent.duration.FiniteDuration, unapplyscala.concurrent.duration.FiniteDuration, scala.concurrent.ExecutionContext>> (TailChoppingRoutingLogic x$0) -
scheduler
-
within
public scala.concurrent.duration.FiniteDuration within() -
interval
public scala.concurrent.duration.FiniteDuration interval() -
context
public scala.concurrent.ExecutionContext context() -
select
Description copied from interface:RoutingLogic
Pick the destination for a given message. Normally it picks one of the passedroutees
, but in the end it is up to the implementation to return whateverpekko.routing.Routee
to use for sending a specific message.When implemented from Java it can be good to know that
routees.apply(index)
can be used to get an element from theIndexedSeq
.- Specified by:
select
in interfaceRoutingLogic
-
copy
public TailChoppingRoutingLogic copy(Scheduler scheduler, scala.concurrent.duration.FiniteDuration within, scala.concurrent.duration.FiniteDuration interval, scala.concurrent.ExecutionContext context) -
copy$default$1
-
copy$default$2
public scala.concurrent.duration.FiniteDuration copy$default$2() -
copy$default$3
public scala.concurrent.duration.FiniteDuration copy$default$3() -
copy$default$4
public scala.concurrent.ExecutionContext copy$default$4() -
productPrefix
- Specified by:
productPrefix
in interfacescala.Product
-
productArity
public int productArity()- Specified by:
productArity
in interfacescala.Product
-
productElement
- Specified by:
productElement
in interfacescala.Product
-
productIterator
- Specified by:
productIterator
in interfacescala.Product
-
canEqual
- Specified by:
canEqual
in interfacescala.Equals
-
productElementName
- Specified by:
productElementName
in interfacescala.Product
-
hashCode
public int hashCode() -
toString
-
equals
-