Skip to content

[Feature] Per-actor message batching (throughput) in ActorCell.run #409

Description

@pathosDev

Rationale

ActorCell.run() drains all system messages, then dequeues exactly one user message and reschedules (src/internal/ActorCell.ts:~403 plus the finally re-schedule). With the default immediate dispatcher every user message pays a full setImmediate round-trip. Akka processes throughput messages per scheduling slot for exactly this reason; ThroughputDispatcher(16) only batches work units across actors — each unit is still a single message.

Scope

  • Process up to throughput-per-actor user messages per execute() slot (HOCON actor-ts.dispatcher.throughput-per-actor, default ~16, optional time budget), then yield.
  • Preserve: system-messages-first ordering, the throttle gate (Token-bucket rate limiting per actor #83), suspend semantics, per-actor dispatcher override via Props config.
  • reference.conf + ConfigKeys entry.

Example configuration:

actor-ts.dispatcher {
  default = "immediate"
  throughput-per-actor = 16    # messages per scheduling slot (previously implicitly 1)
}

Documentation

  • Dispatcher docs (EN + DE) incl. the fairness trade-off (large batches can starve I/O).
  • CHANGELOG entry; HOCON key reference.

Acceptance

  • tell/ask throughput benchmarks improve ≥ 2× under the default dispatcher; become/unbecome bench flat; ordering + throttle tests green.

Relates

Improvement program M2. #27, #83; pairs with the ring-buffer mailbox issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: highTop priority — high impact, plan nextproduction-goalBlocks or defines the path to production readiness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions