Skip to content

Fix Actor Memory Overhead Model #3091

Closed

Description

We don't do a very good job accounting for actors' memory overhead today, which is a bit of a problem with the multi-actor worker model.

Today the micro-VM worker takes a flat 128MiB out of each actor's memory limit for the VMM, which is too much for small guests and too little for large ones, and nothing else accounts for what an actor costs outside its sandbox when placing it.

I propose the following API:

  • Wrap SandboxRuntime in WorkerRuntime, which also has RuntimeOverhead
  • RuntimeOverhead contains a fixed memory + proportional memory overhead (proportional to the actor's memory limit)

The overhead hangs off the runtime rather than the worker, because it depends on the runtime: A worker can restore actors under older runtime versions, and we may have workers that run more than one sandbox class. Snapshot and WorkerAssignment keep the plain SandboxRuntime, so the overhead isn't part of compatibility matching.

The behavior change is then:

  • micro-VM stops subtracting 128MiB from the actor template's memory limit, the guest gets all of it
  • scheduling starts considering the worker-published overhead model when booking an actor
  • workers report their memory limit minus a small fixed amount for themselves (the worker process and in-flight snapshot writes) as capacity

Diff:

Details

(your diff, unchanged)


This issue is related to the next one I'll file, around mitigating OOMKill ...

Activity

  1. thockin commented on Oct 21, 2026

    @thockin
    Collaborator

    We spoke IRL and this model feels right to me.

  2. EItanya commented on Oct 21, 2026

    @EItanya
    Collaborator

    Seconded that this feels right

  3. BenTheElder commented on Oct 22, 2026

    @BenTheElder
    CollaboratorAuthor

    Note: the API changed since this was drafted, so WorkerSandboxRuntime is a real object that will obviate introducing WorkerRuntime but otherwise the proposal stands.

  4. BenTheElder commented on Oct 22, 2026

    @BenTheElder
    CollaboratorAuthor
  5. mowangdk commented on Oct 25, 2026

    @mowangdk
    Contributor

    Shouldn't the CPU have a similar mechanism as well?

  6. BenTheElder commented on Oct 25, 2026

    @BenTheElder
    CollaboratorAuthor

    Maybe, but CPU is compressible, memory is causing downtime (#3092, filed in conjunction with this), so CPU can be enhanced post-GA. The sandbox processes are anyhow not using a lot of CPU directly (though they can still have CPU cost in a different way due to syscall/interrupt handling etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/apiUser-facing API changesarea/nodearea/schedulingkind/designDesign discussion, investigation, or research required before implementation

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions