Skip to content

microVM: restore and snapshot no longer run under the actor's CPU limit - #3802

Draft
Ridwan Hoq (ridhoq) wants to merge 1 commit into
agent-substrate:mainfrom
ridhoq:cgroup-cpu
Draft

Ridwan Hoq (ridhoq) wants to merge 1 commit into
agent-substrate:mainfrom
ridhoq:cgroup-cpu

Conversation

@ridhoq

Copy link
Copy Markdown

Fixes #3801

On microVM, the worker restores and snapshots an actor inside the actor's cgroup leaf, under the actor's CPU limit. Small actors resume and suspend slowly as a result. This runs that work at max(4x,1000m), like gVisor's default --sandbox-lifecycle-cpu-policy:

  • OpenActorLeaf gets the lifecycle limit on restore and cold boot.
  • The worker writes the actor's own limit before wakeupprobe.WaitAll. The actor decides when its probe passes, so the probe runs under the actor's limit.
  • CheckpointWorkload raises the limit after vm.pause, and puts the actor's limit back if the checkpoint fails.
  • Teardown and the restore and boot failure paths raise the limit before stopping cloud-hypervisor, which frees guest RAM on exit.

I measured an earlier version of this change on v1.0.0. It also refused to reuse a leftover leaf that still held processes, and lifted the cap in KillLeafUnder. I dropped both because neither triggered in these runs. AKS, 4 × Standard_D16ds_v7, kernel 6.8.0-1073-azure, 256 MiB glutton, 16 actors woken at 4/s in total, about 960 resumes per row. p50 / p95 in ms:

limit worker resume restore throttled suspend p95 checkpoint throttled
1000m v1.0.0 150 / 170 0 / 0 150 0 / 0
1000m this change 150 / 190 0 / 0 150 0 / 0
500m v1.0.0 180 / 200 23 / 47 200 30 / 158
500m this change 150 / 190 0 / 0 140 0 / 0
250m v1.0.0 310 / 350 136 / 203 330 208 / 370
250m this change 150 / 170 0 / 0 140 0 / 0
100m v1.0.0 2,400 / 2,600 1,864 / 2,170 2,600 1,460 / 1,706
100m this change 160 / 230 0 / 21 270 74 / 267

At 100m some throttling is left. Checkpoint runs under the actor's limit until vm.pause returns, and the wakeup probe runs under it by design (p95 115 ms against 39 ms at 1000m).

Draft until #3801 settles the approach. I think this fits v1.1.

AI use: AI-assisted (GitHub Copilot CLI). It read the code, wrote the change and the benchmark harness, and drafted this description. I reviewed the change and checked the numbers.

  • Tests pass
  • Docs updated

Signed-off-by: Ridwan Hoq <943533+ridhoq@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MicroVM restore and suspend run inside the actor's CPU limit, so small actors wake slowly

1 participant