feat: cut over to WASM backend

This commit is contained in:
udo
2026-06-13 08:42:31 +00:00
parent 577aae076e
commit afaa4dd7c0
16 changed files with 603 additions and 25 deletions
+7 -5
View File
@@ -42,11 +42,13 @@ Artifacts are written under `/tmp/uce/wasm-phase5/`:
- `sqlite-page`: `/demo/sqlite.uce`
- `component-heavy-starter`: `/examples/uce-starter/?dashboard`
`benchmark.py` also accepts `--wasm-base-url` once a WASM worker endpoint exists.
When provided, it compares WASM medians against the Phase 5 budget of ≤2× native
page latency. Workspace birth and internal component call overhead budgets still
need worker-internal probes; this harness documents the gap rather than faking
those numbers.
`benchmark.py` also accepts `--wasm-base-url` when native and WASM are served
from separate endpoints. For the W5 in-place cutover, use
`--backend-label wasm --compare-native-json <native benchmark.json>` after
switching `/etc/uce/settings.cfg` to the WASM backend; this compares WASM
medians against the Phase 5 budget of ≤2× native page latency. W5 worker builds
emit `X-UCE-Wasm-Workspace-Birth-Us` and component resolve probe headers on
WASM-served responses.
A durable informational baseline snapshot is kept in `reports/`. Paired
native/WASM runs still recompute native medians for the actual budget decision.
+8 -2
View File
@@ -122,6 +122,8 @@ def main() -> int:
parser = argparse.ArgumentParser(description="Phase 5 native/wasm benchmark harness")
parser.add_argument("--native-base-url", default="http://localhost:80")
parser.add_argument("--wasm-base-url", default="", help="optional wasm worker URL; omitted until worker exists")
parser.add_argument("--backend-label", default="native", help="label for --native-base-url measurements when running one backend at a time")
parser.add_argument("--compare-native-json", default="", help="optional prior native benchmark.json for budget comparison")
parser.add_argument("--host-header", default="uce.openfu.com")
parser.add_argument("--warmups", type=int, default=2)
parser.add_argument("--samples", type=int, default=20)
@@ -130,7 +132,11 @@ def main() -> int:
args = parser.parse_args()
targets = build_targets()
results = measure_backend("native", args.native_base_url, args.host_header, targets, args.warmups, args.samples, args.timeout)
results: list[Measurement] = []
if args.compare_native_json:
for row in json.loads(Path(args.compare_native_json).read_text()):
results.append(Measurement(**row))
results.extend(measure_backend(args.backend_label, args.native_base_url, args.host_header, targets, args.warmups, args.samples, args.timeout))
if args.wasm_base_url:
results.extend(measure_backend("wasm", args.wasm_base_url, args.host_header, targets, args.warmups, args.samples, args.timeout))
@@ -138,7 +144,7 @@ def main() -> int:
out_dir.mkdir(parents=True, exist_ok=True)
(out_dir / "benchmark.json").write_text(json.dumps([asdict(r) for r in results], indent=2) + "\n")
md_lines = ["# Phase 5 benchmark report", "", *compare(results), ""]
if not args.wasm_base_url:
if not args.wasm_base_url and args.backend_label == "native" and not args.compare_native_json:
md_lines.append("WASM worker URL was not provided; this report is the native baseline that future wasm runs compare against.")
(out_dir / "benchmark.md").write_text("\n".join(md_lines) + "\n")
print("\n".join(md_lines))