Experimental web-based simulator for exploring metastable behaviors in distributed systems
TypeScript
86
50 commits
updated May 13, 2026
Try it live at stability-sim.systems
A browser-based discrete-event simulation builder for distributed systems. Compose architectures from abstract components, define traffic patterns and failure scenarios, and observe emergent behaviors like metastable failures, retry amplification, queue buildup, and congestive collapse — all in your browser, no backend required.
Stability Sim lets you visually build a distributed system topology from standard building blocks:
Once you've wired up an architecture, you can inject failures at specific simulation times and watch the system respond in real time:
The metrics dashboard shows latency percentiles, throughput, queue depth, utilization, and custom per-component metrics as live time-series charts.
Load these from the Examples menu, or deep-link with ?example=<id>:
| Example | ID | What it demonstrates |
|---|---|---|
| Metastable Failure (Retry Storm) | metastable-retry | Aggressive retries sustain overload after a server crash |
| GC Pressure Death Spiral | gc-death-spiral | Load-dependent latency creates a tipping point |
| Connection Pool Exhaustion | connection-pool-exhaustion | DB latency spike drains connection pool |
| Cache Stampede | cache-stampede | TTL expiry and queue buildup create a stampede |
| Cache Flush Metastability | cache-flush | Instantaneous cache loss overwhelms the backend |
| Timeout Cascade | timeout-cascade | High utilization + exponential variance = intermittent failure |
| LB Sinkholing | lb-sinkholing | Least-connections routes traffic to a crashed server |
| Goodput Collapse | goodput-collapse | Stale queue: high throughput but zero goodput |
The simulation is a priority-queue-driven discrete-event engine. Events (arrivals, departures, failures, recoveries, timeouts) are processed in strict timestamp order. A seedable xoshiro128** PRNG ensures deterministic, reproducible results.
The engine runs in a Web Worker so the UI stays responsive. The main thread and worker communicate via a typed message protocol (start, pause, resume, step, reset, setSpeed). Metric snapshots are posted back at regular simulation-time intervals and rendered as live charts.
┌─────────────────────────────────────────────────────┐
│ UI Layer (React + React Flow + Recharts) │
│ Builder canvas, properties panel, dashboard, controls│
├─────────────────────────────────────────────────────┤
│ State Layer (Zustand) │
│ Architecture store, simulation store, metrics store │
├─────────────────────────────────────────────────────┤
│ Engine Layer (Web Worker) │
│ SimulationEngine, PriorityQueue, MetricCollector, │
│ Component models, FailureInjector, SeededRNG │
├─────────────────────────────────────────────────────┤
│ Persistence Layer │
│ JSON serializers, URL codec, schema migrations │
└─────────────────────────────────────────────────────┘
npm install
npm run dev
Open the URL printed by Vite (typically http://localhost:5173).
npm run build
npm run preview
npm test
This runs unit tests and property-based tests (via Vitest and fast-check).
The site deploys to AWS via CDK (S3 + CloudFront + Route53). See infra/README.md.
npm run build
cd infra && npx cdk deploy --profile <your-profile>
src/
├── components/ # React UI components (palette, panels, node renderers)
│ └── nodes/ # Custom React Flow node types per component
├── engine/ # Simulation engine, Web Worker, PRNG, metric collector
│ └── components/ # Simulation component models (client, server, etc.)
├── examples/ # Built-in example scenarios and load logic
├── persistence/ # JSON serializers, URL codec, schema migrations
├── stores/ # Zustand state stores
└── types/ # TypeScript type definitions
infra/ # CDK deployment (S3, CloudFront, Route53)
50 commits
TypeScript
98.2%
CSS
1.7%
Experimental web-based simulator for exploring metastable behaviors in distributed systems
TypeScript
86
50 commits
updated May 13, 2026
Try it live at stability-sim.systems
A browser-based discrete-event simulation builder for distributed systems. Compose architectures from abstract components, define traffic patterns and failure scenarios, and observe emergent behaviors like metastable failures, retry amplification, queue buildup, and congestive collapse — all in your browser, no backend required.
Stability Sim lets you visually build a distributed system topology from standard building blocks:
Once you've wired up an architecture, you can inject failures at specific simulation times and watch the system respond in real time:
The metrics dashboard shows latency percentiles, throughput, queue depth, utilization, and custom per-component metrics as live time-series charts.
Load these from the Examples menu, or deep-link with ?example=<id>:
| Example | ID | What it demonstrates |
|---|---|---|
| Metastable Failure (Retry Storm) | metastable-retry | Aggressive retries sustain overload after a server crash |
| GC Pressure Death Spiral | gc-death-spiral | Load-dependent latency creates a tipping point |
| Connection Pool Exhaustion | connection-pool-exhaustion | DB latency spike drains connection pool |
| Cache Stampede | cache-stampede | TTL expiry and queue buildup create a stampede |
| Cache Flush Metastability | cache-flush | Instantaneous cache loss overwhelms the backend |
| Timeout Cascade | timeout-cascade | High utilization + exponential variance = intermittent failure |
| LB Sinkholing | lb-sinkholing | Least-connections routes traffic to a crashed server |
| Goodput Collapse | goodput-collapse | Stale queue: high throughput but zero goodput |
The simulation is a priority-queue-driven discrete-event engine. Events (arrivals, departures, failures, recoveries, timeouts) are processed in strict timestamp order. A seedable xoshiro128** PRNG ensures deterministic, reproducible results.
The engine runs in a Web Worker so the UI stays responsive. The main thread and worker communicate via a typed message protocol (start, pause, resume, step, reset, setSpeed). Metric snapshots are posted back at regular simulation-time intervals and rendered as live charts.
┌─────────────────────────────────────────────────────┐
│ UI Layer (React + React Flow + Recharts) │
│ Builder canvas, properties panel, dashboard, controls│
├─────────────────────────────────────────────────────┤
│ State Layer (Zustand) │
│ Architecture store, simulation store, metrics store │
├─────────────────────────────────────────────────────┤
│ Engine Layer (Web Worker) │
│ SimulationEngine, PriorityQueue, MetricCollector, │
│ Component models, FailureInjector, SeededRNG │
├─────────────────────────────────────────────────────┤
│ Persistence Layer │
│ JSON serializers, URL codec, schema migrations │
└─────────────────────────────────────────────────────┘
npm install
npm run dev
Open the URL printed by Vite (typically http://localhost:5173).
npm run build
npm run preview
npm test
This runs unit tests and property-based tests (via Vitest and fast-check).
The site deploys to AWS via CDK (S3 + CloudFront + Route53). See infra/README.md.
npm run build
cd infra && npx cdk deploy --profile <your-profile>
src/
├── components/ # React UI components (palette, panels, node renderers)
│ └── nodes/ # Custom React Flow node types per component
├── engine/ # Simulation engine, Web Worker, PRNG, metric collector
│ └── components/ # Simulation component models (client, server, etc.)
├── examples/ # Built-in example scenarios and load logic
├── persistence/ # JSON serializers, URL codec, schema migrations
├── stores/ # Zustand state stores
└── types/ # TypeScript type definitions
infra/ # CDK deployment (S3, CloudFront, Route53)
50 commits
TypeScript
98.2%
CSS
1.7%