Repository navigation
[WIP] ateapi: prefer the node that cached a suspended actor's snapshot - #2512
Walter Fender (cheftako) wants to merge 6 commits into
Conversation
Attach the kata guest image as a read-only virtio-pmem device (discard_writes) and mount its root filesystem with DAX, instead of attaching it as a virtio-blk disk. Under DAX the guest reads and executes the image's files straight from the host mapping instead of copying them into its own page cache. What the guest reads from its image (35.0MiB by the end of a cold boot) therefore no longer lands in guest RAM, so it also stays out of every snapshot. Those pages live once in the host page cache, shared by every actor on the node. kata builds its image for this: osbuilder's DAX header puts the root filesystem at /dev/pmem0p1, and the image size is a multiple of 2MiB. The kata kernel has CONFIG_VIRTIO_PMEM and CONFIG_FS_DAX. Snapshots taken before this change keep restoring with a virtio-blk image, because CH rebuilds whatever devices their own config.json names.
…vert README change
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
| // | ||
| // +k8s:optional | ||
| // +k8s:format=k8s-long-name | ||
| string cached_snapshot_node = 13; |
There was a problem hiding this comment.
Maybe last_assigned_node?
| requiredNodes = []string{node} | ||
| } | ||
| if node := actor.GetStatus().GetCachedSnapshotNode(); node != "" { | ||
| preferredNodes = []string{node} |
There was a problem hiding this comment.
🤖 should-fix 🟡 – If the preferred node's worker just filled up in the store, BindActorToWorker returns errWorkerFilledUp and leaves workerCache unchanged until the watch catches up. Because Schedule discards all non-preferred candidates while the cached worker still looks free, ensureWorkerAssigned will keep re-selecting that same full worker on every retry instead of falling back to other nodes. Clear CachedSnapshotNode on the in-memory actor copy when retrying after errWorkerFilledUp in cmd/ateapi/internal/controlapi/workflow_resume.go:284.
| toUpdate.Status.WorkerAssignment = nil | ||
| // The node keeps the snapshot's files after uploading them, so a resume | ||
| // there skips the download. | ||
| toUpdate.Status.CachedSnapshotNode = toUpdate.Status.AssignedNode |
There was a problem hiding this comment.
🤖 should-fix 🟡 – This also sets CachedSnapshotNode when suspending a PAUSED actor, but UploadPausedCheckpoint in cmd/atelet/main.go:972 prunes the local checkpoint without calling cacheSuspendedCheckpoint. Either populate the suspend cache in UploadPausedCheckpoint before pruning, or only record CachedSnapshotNode for running-origin suspends.
| func(oldObj *ateapipb.ActorStatus) *string { | ||
| return &oldObj.CachedSnapshotNode | ||
| }) | ||
| errs = append(errs, fn(fldPath.Child("cached_snapshot_node"), &obj.CachedSnapshotNode, oldVal, oldObj != nil)...) |
There was a problem hiding this comment.
🤖 nit 🟢 – Add valid and invalid test cases for status.cached_snapshot_node in cmd/ateapi/internal/apivalidation/actor_test.go:424 alongside status.assigned_node.
A suspend uploaded the actor's checkpoint and then deleted it from the node. Resuming the actor on the same node then fetched the manifest and downloaded and decompressed the same files again: on the counter-microvm demo, ~100ms of a ~210ms node-side resume. After a successful upload, move the checkpoint directory into a per-actor suspend cache entry keyed by the snapshot URI, and write its manifest there. A snapshot URI names one immutable snapshot, so a resume from that URI on this node can move the files into the restore directory instead of downloading them, and skips the manifest fetch too. Any problem with an entry falls back to object storage. An actor keeps at most one entry, dropped when it is restored from any other snapshot or terminated. --suspend-cache-max-bytes (default 4GiB, 0 disables) bounds the node's entries, evicting the oldest first, for actors that resume elsewhere.
atelet keeps a suspended actor's snapshot files on the node after uploading them, and a resume on that node skips the download (~100ms of a ~210ms node-side resume on the counter-microvm demo). But the scheduler picked among all eligible workers at random, so on a cluster of N nodes a resume landed back on the caching node about one time in N. Record the node an actor is suspended from in the new ActorStatus.cached_snapshot_node, and have the scheduler narrow placement to workers on that node when one of them meets the other constraints and has room. It is only a preference: with no room there, the actor is placed anywhere, as before. Assigning a worker clears the field, since a resume consumes the cached files wherever it lands.
01df901 to
cbf573e
Compare
|
This PR has been closed due to inactivity. If you believe this to be a mistake feel free to re-open with a comment explaining why this PR is still relevant and a maintainer will revisit it, thanks so much Comment left by Claude on behalf of Eitan Yarmush (@EItanya). |
Breaking change
Fixes #<issue_number_goes_here>