Internal dispatcher to protect against starvation (#26816)

* Allow for dispatcher aliases and define a internal dispatcher
* Test checking dispatcher name
* MiMa for Dispatchers
* Migration guide entry
* No need to have custom dispatcher lookup logic in streams anymore
* Default dispatcher size and migration note about that
* Test checking exact config values...
* Typed receptionist on internal dispatcher
* All internal usages of system.dispatcher gone through
This commit is contained in:
Johan Andrén 2019-05-02 22:35:25 +02:00 committed by Patrik Nordwall
parent e34a711adf
commit 81b1e2ef9b
57 changed files with 524 additions and 329 deletions

View file

@ -26,10 +26,9 @@ akka.cluster.distributed-data {
# the replicas. Next chunk will be transferred in next round of gossip.
max-delta-elements = 1000
# The id of the dispatcher to use for Replicator actors. If not specified
# default dispatcher is used.
# The id of the dispatcher to use for Replicator actors.
# If specified you need to define the settings of the actual dispatcher.
use-dispatcher = ""
use-dispatcher = "akka.actor.internal-dispatcher"
# How often the Replicator checks for pruning of data associated with
# removed cluster nodes. If this is set to 'off' the pruning feature will

View file

@ -243,7 +243,7 @@ final class LmdbDurableStore(config: Config) extends Actor with ActorLogging {
dbPut(OptionVal.None, key, data)
} else {
if (pending.isEmpty)
context.system.scheduler.scheduleOnce(writeBehindInterval, self, WriteBehind)(context.system.dispatcher)
context.system.scheduler.scheduleOnce(writeBehindInterval, self, WriteBehind)(context.dispatcher)
pending.put(key, data)
}
reply match {

View file

@ -80,10 +80,7 @@ object ReplicatorSettings {
* the default configuration `akka.cluster.distributed-data`.
*/
def apply(config: Config): ReplicatorSettings = {
val dispatcher = config.getString("use-dispatcher") match {
case "" => Dispatchers.DefaultDispatcherId
case id => id
}
val dispatcher = config.getString("use-dispatcher")
val pruningInterval = toRootLowerCase(config.getString("pruning-interval")) match {
case "off" | "false" => Duration.Zero
@ -299,7 +296,7 @@ final class ReplicatorSettings(
def withDispatcher(dispatcher: String): ReplicatorSettings = {
val d = dispatcher match {
case "" => Dispatchers.DefaultDispatcherId
case "" => Dispatchers.InternalDispatcherId
case id => id
}
copy(dispatcher = d)

View file

@ -162,7 +162,7 @@ class ReplicatorMessageSerializer(val system: ExtendedActorSystem)
system.scheduler.schedule(cacheTimeToLive, cacheTimeToLive / 2) {
readCache.evict()
writeCache.evict()
}(system.dispatcher)
}(system.dispatchers.internalDispatcher)
private val writeAckBytes = dm.Empty.getDefaultInstance.toByteArray
private val dummyAddress = UniqueAddress(Address("a", "b", "c", 2552), 1L)