Isolate-class workers: wasmtime runtime host + fold-wasm#5
Open
nishu-builder wants to merge 1 commit into
Open
Isolate-class workers: wasmtime runtime host + fold-wasm#5nishu-builder wants to merge 1 commit into
nishu-builder wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]>
4327419 to
c759510
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fold over an N-node tree issues ~2N serial
/runcalls at a full container lifecycle each (~324ms p50, traced: ~100% container dispatch). This adds an isolate-class worker mechanism so orchestration-heavy recursive workers run as ~µs wasm isolates instead, withpre/postvisitors staying ordinary docker images.Results (OrbStack aarch64 VM, docker backend)
tests/fold-bench)crates/(60 nodes), viacaos-clitests/fold-wasm) — parent frames suspend inrun_manyholding no slot/thread/container, so the warm-pool deadlock class is impossible by construction.What's in here
{".caos-runtime": <blob: host image ref>, "module": <blob>}.compute.rsdetects the marker beforeresolve_imageand POSTs the job to a warmcaos-isolate-host-{key}container (no SLOT — unlimited concurrent isolates). Memoization, cycle detection, and result pinning are shared with container workers; the marker carries the host image hash, so cache keys cover the runtime version. Future runtimes (TS/V8 host, runner-as-runtime) are additive.crates/isolate-host: musl-static wasmtime 46 host (pooling allocator). Guest ABIcaos_abi_v1—job/tree/get/put_blob/put_tree/run/run_many/out/logover two wasm imports (JSONcall/read). Deterministic WASI stubs (clock=0, fixed random, no fs/net/env).run_manyfans nested runs out on OS threads (16-way, order-preserving). Tree encoding is pinned byte-identical to git's (unit test).crates/isolate-common+crates/fold-wasm(wasm32-wasip1, 140KB): fold ported to the ABI; children fold via onerun_manybatch; blob children with nopreshort-circuit straight to thepostrequest with the canonical empty children tree. Request construction is byte-identical to the container client's — traces confirm container fold's leaf requests cache-hit entries created by fold-wasm (cross-implementation aliasing works).caos-traceper/run(parent edge, depth, per-phase ms) +tests/trace-report.py(summary/waterfall);isolate-traceper host job.caos-isolate-host(service image) and.#fold-wasm;build-builtins.shpublishes std entriesisolate-host(pins the host image objects) andfold-wasm(the runtime node). Toolchain gainswasm32-wasip1.tests/fold-wasm(parity with container fold incl. symlink leaf = 31, deep chain, memoized rerun),tests/fold-bench(three-way benchmark). Includes two drive-by fixes fornix flake checkunder the refreshed toolchain lock (clippytype_complexityin the fly path via aBaseLayersalias; fmt reflow).Semantics notes / open questions
See
design/isolate-runtime-spike.md. Notable: container fold follows symlink-to-dir children, fold-wasm treats them as leaf blobs (parity pinned only for symlink-to-file, where both agree — arguably the container behavior is the bug). Also open: visitor strategy (wasm visitors vs elastic container pool),run_manybound tuning, host-container reaping.Verification
nix flake checkgreen; 3 isolate-host unit tests;tests/fold-wasm,tests/fold-benchpass.tests/{deep-deps,file-count,dirs-only,symlinks,untracked}all pass — the docker path is untouched.Related Asana: Make workers fast, Parallelization for fold, Add v8isolate workers?
🤖 Generated with Claude Code