Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Slice 3 of the P6-on-Kubernetes epic: sandbox tier selection and session-to-sandbox affinity
Part of epic #426. Written so a planner can start it in a fresh session. This is not specific to Kubernetes: the VM path (deploy/vm + deploy/microvm) hits the same limits as soon as it has more than one P4 host or mixes tiers. It is the only slice that changes the harness.
Problem
selectPoolSandbox (harness/src/select-sandbox.ts) selects again on every turn: the least-loaded presence record under the soft cap, from all of the relay's records. Two things follow.
- No tier. A record carries only
sandboxId,capabilitiesandcapacityMax;session.Confighas no labels. Container sandboxes and P4 microVM workers therefore cannot share a relay without a session's turns moving between tiers (deploy/microvm/P4-ON-P6.md, "A P4-only host": "Choosing the tier per session ... is not built"). - No affinity. P4 keeps a session's workspace at
SH_WORKSPACE_ROOT/<session id>on the worker host (select-sandbox.ts:446-456). With more than one P4 worker, turn N+1 can land on a host with no workspace for that session. So P4 cannot scale horizontally.
Scope (for the design to settle)
- Tier label on presence records: carried in the worker's
Hello(or derived from capabilities), stored by the relay insh:sandbox:records, and filtered on inselectPoolSandbox. - Choosing the tier: a session attribute set at creation (control plane /
mocactl), a deployment default, or both. Decide what happens to an existing session when its tier's capacity is gone: wait, 429, or fail. - Session-to-sandbox affinity: prefer the sandbox that served the session's previous turn. Decide what happens when it is saturated or gone: queue, 429, or fall back with a recorded workspace loss. Keep concurrent turns of one session consistent (
holderIdvssessionId,select-sandbox.ts:384-389). A shared workspace store is the alternative to affinity; compare the two in the design. - Leases and records: affinity must survive a relay restart, when every worker reattaches.
Acceptance
- One relay with both container sandboxes and P4 workers attached: every turn of a P4 session lands on P4, every turn of a container session lands on a container, and nothing silently moves between tiers.
- Two P4 workers: a session's turn 2 sees turn 1's files across many sessions, and load still spreads across hosts.
- The "one tier per host" caveat in
P4-ON-P6.mdand the slice-2 single-host limit are removed or rewritten.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
docs: P6.3 spec, sandbox tiers and session-to-sandbox affinity (#425)
docs: P6.3 spec v1.1, corrections from the implementation plan (#425)
feat(remote-worker): workers advertise their sandbox tier as moca.dev…
feat(harness): sandbox tier configuration and a Redis affinity store (#…
feat(sandbox-relay): a detach mark per sandbox, written on teardown a…
fix(sandbox-relay): prettier formatting and enhanced test 4 assertions (
feat(harness): selectPoolSandbox keeps a session in its sandbox tier (#…
fix(harness): a tier's empty error names the tier and the fix, not an…
feat(harness): session-to-sandbox affinity, with a grace period and a…
fix(harness): affinity waits out the grace for an unlabelled sandbox …
feat: a turn reports its sandbox placement and a workspace_reset frame (
fix: workspace_reset emit releases the lease on a throwing sink; omit…
test(sandbox-relay): tiers and affinity end to end over real Redis (#425
21 remaining items
test(deploy/compose): the tier-parity check renders both services wit…
fix(knative-server,control-plane): validate the sandbox tiers at work…
docs(specs): P6.3 v1.4 — tiers only on a mixed stack; boot validation…
feat(deploy/microvm): a host with container sandboxes and P4 is tiere…
feat(deploy/microvm): a sticky default tier; p4-turn-smoke runs on a …
fix(deploy/microvm): try-restart only the P6 units that exist; the de…
docs(demos): a session returns to its sandbox; when it waits and when…
feat(deploy/k8s): a stack with container sandboxes and P4 hosts is ti…
test(deploy/k8s): smoke claim 12, a session stays on its sandbox; a t…
fix(deploy/microvm): a mixed host is tiered only when its running con…
fix(deploy/k8s): kind refuses a bad SH_SANDBOX_DEFAULT_TIER; SH_SANDB…
fix(deploy/k8s): smoke claim 12 prints the affinity-or-luck note only…
docs(specs): P6.3 §0.4 and §7 -- where each path keeps its sticky def…
Merge pull request #454 from pdettori/feat/425-slice3-pr3
Fix: persist Redis so a setup-vm.sh re-run keeps every session