feat(fizz): add --parallel N for multi-process simulation#360
Merged
Conversation
Each worker is its own fizzbee subprocess, which sidesteps the in-process shared-state hazards (roleRefs, nextChannelId, and others not yet audited) that block goroutine-based parallelism. Tradeoff: N process-startup overheads per run (~50ms each, negligible vs typical sim wall time) and per-worker output dirs instead of interleaved stdout. Activates only when -x is set, no fixed --seed (a seed forces a single run anyway), and --parallel > 1. Otherwise falls through to the existing single-process invocation unchanged. Behavior: - Splits --max_runs evenly across workers (0 -> unlimited per worker). - Each worker writes to <base>/parallel_<ts>/worker_<N>/ + worker_<N>.log. - Polling loop checks every 500ms: if a worker writes the failure sentinel, kill surviving workers; otherwise wait for all to finish. - Ctrl-C kills all live workers and exits 130. - On success: aggregate "PASSED: N total runs across W workers". - On failure: print the first failing worker's full log + output dir. Measured: 13-02-01 two-phase-commit, 1000 sims, sequential 52.7s vs parallel=4 19.8s on macOS arm64 (2.65x speedup). Compatible with macOS bash 3.2 — uses only basic array, arithmetic, and process-control features. set -e is disabled inside the block so expected non-zero exits (kill of dead worker, grep miss) don't abort the script; we exit explicitly at the end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Each worker is its own fizzbee subprocess, which sidesteps the in-process shared-state hazards (roleRefs, nextChannelId, and others not yet audited) that block goroutine-based parallelism. Tradeoff: N process-startup overheads per run (~50ms each, negligible vs typical sim wall time) and per-worker output dirs instead of interleaved stdout.
Activates only when -x is set, no fixed --seed (a seed forces a single run anyway), and --parallel > 1. Otherwise falls through to the existing single-process invocation unchanged.
Behavior:
Measured: 13-02-01 two-phase-commit, 1000 sims, sequential 52.7s vs parallel=4 19.8s on macOS arm64 (2.65x speedup).
Compatible with macOS bash 3.2 — uses only basic array, arithmetic, and process-control features. set -e is disabled inside the block so expected non-zero exits (kill of dead worker, grep miss) don't abort the script; we exit explicitly at the end.