vortex

vortex: design

@avarok/vortex 0.1.0 · Updated

vortex is a worker thread pool whose core (queues, scheduling, worker accounting, backpressure, timing) is Rust compiled to wasm32-unknown-unknown with shared memory, and whose public interface is a drop-in replacement for piscina 5.3.2.

Status: phases 2a–2c done (core, Node.js shim; piscina 5.3.2's suite passes unmodified). Behaviour differences: COMPAT.md.

Chapters

  1. The interface vortex matches: pinned version, every export, option, method, event, property, static, worker convention and error string, with defaults and validation.
  2. Architecture: one shared WebAssembly.Memory, the Rust core (no_std, lock-free, no allocator, survives a worker killed at any instruction), the JS shim and why each JS piece cannot be Rust, task lifecycle, scheduling modes, the three-lane codec, browsers.
  3. Where the speed comes from: piscina's per-task costs read from its source, the techniques that remove them, their risks, and honest limits.
  4. Proof plan: piscina's own test suite run unmodified against vortex, the benchmark harness and its rules, Rust concurrency tests (loom, death injection).
  5. Phased plan and owner decisions.
  6. Where piscina spends per-task time: CPU-profile shares (not benchmarks) behind the scheduling decisions.
  7. The Rust core as built: protocols, why SeqCst fences, histograms, verification record with negative controls, gaps for phase 2c.
  8. The Node.js shim as built: push placement through per-worker inboxes (and why it replaced pull for now), the per-task path, worker waits, worker records, verification record with negative controls.

Decisions in one place