Numbers validated against queueing theory, not animated request flow.
The simulator's test suite runs the engine against eight textbook queueing results and fails if the simulated numbers drift too far from the formulas. The checks hold in steady state, with timeouts and retries switched off; timeouts, retries, caches under failure and load shedding have no closed form, so they are tested for behaviour, not against a formula.
8 Queueing Results the Simulator Is Tested Against
Each check runs a seeded simulation at fixed parameters and compares it with the formula. The tests live in the simulator's own repository, which is not public yet, and run with npm test there. Theory applies strictly under steady-state conditions (timeoutMs = 0 and maxRetries = 0).
M/M/1 mean latency
One worker with Poisson arrivals at 50 requests a second and exponential 10 ms service, so it is 50% busy. The simulated mean latency must land within 5% of the formula, and utilization within 2 points.
M/M/c/K latency and blocking
Four workers at 40 ms with a 10-slot queue and 90 requests a second, so the pool is about 90% busy and some requests are turned away. Mean latency must be within 5%, utilization within 2 points and the drop rate within 0.6 points of the closed form.
The same queue built on the canvas
The M/M/4/10 queue above, built from a client box and a service box in the graph engine, then again behind a load balancer that should change nothing. Both must match the closed form for latency, utilization and drops.
Every request is accounted for
After two minutes of overload, every request that arrived must be completed, dropped, shed, timed out or still in the system, with nothing lost or counted twice. Little's Law (L = λW) is checked separately in the theory model, to six decimal places.
M/G/1 Pollaczek-Khinchine
Service times with a coefficient of variation of 3, a long tail like slow database queries. The simulated mean must be within 12% of the Pollaczek-Khinchine formula and more than twice the exponential case.
M/D/1 deterministic service
Every request takes exactly 10 ms. The formula predicts half the queueing wait of the exponential case, and the simulated mean latency must be within 5% of it.
Random balancing and cache thinning
A random load balancer splits 160 requests a second across two M/M/4/10 servers, and each must match theory at 80 a second. A cache with an 80% hit ratio must pass 20 of 100 requests a second to the database. Round robin is only checked for an even split: it makes arrivals more regular than Poisson, so the formula does not apply to it.
Closed-loop finite source
A fixed crowd of users who each wait 1 s between requests: 50 users, then 200 that saturate four workers at 40 ms. Throughput must be within 2% and mean latency within 5% of the finite-source model.
Where Every Number Comes From
A simulator is only as trustworthy as its inputs. StackMonkey explicitly tags the provenance of every component and parameter so you can audit the chain of evidence.
Hardware Loopback Tests
Base framework and storage engine costs timed on dedicated 2 vCPU loopback hardware. Covers Rust, Go, Java 21, Node 22, Python 3.13; Postgres 16, MariaDB, Redis 7, and RabbitMQ.
Cloud Vendor Limits
Derived directly from published SLA and architecture limits: DynamoDB partition token buckets, Kafka partition consumer group concurrency, and S3 503 SlowDown capacity ceilings.
Algorithmic Queues
Approximations for complex multi-node distributed primitives where loopback timing is impractical: multi-region network latency, Cassandra replica rings, and cross-shard scatter-gather.
User-Defined Logic
Your proprietary business logic, custom service runtimes, and external third-party webhook latencies. These inputs are provisional placeholders until calibrated with production telemetry.
Why Math Alone Fails in Production
Closed-form queueing equations only apply in steady state with zero timeouts (timeoutMs = 0) and zero retries (maxRetries = 0). The instant clients begin timing out after 150ms and retrying three times, the steady-state assumption collapses:
Textbook equations establish the baseline ceiling; StackMonkey’s discrete event engine simulates the nonlinear cascade that closed-form math cannot calculate.
8 Honest Technical Bounds (What We Do Not Model)
We believe in total transparency. StackMonkey is designed to evaluate architectural queue contention, backpressure, and capacity limits, not to make inflated claims.
Simulate Your Design Against Textbook Theory
Drag boxes, configure queue depths, inject failure scenarios, and verify where your architecture breaks before shipping to production.
Queue Theory Applied to Production Architectures
See how Little’s Law, finite buffer drops, and service time variance show up in the system design templates.
Rate Limiter System Design
Finite capacity token buckets that reject traffic with HTTP 429 once buffers fill, preventing thread starvation.
URL Shortener System Design
Calculates how 50k QPS across 25ms database latency demands 1,250 concurrent connections, overflowing standard connection pools.
Chat System Design
500k persistent WebSockets where client reconnections create a closed population loop that triggers thundering herds.
Video Streaming System Design
Models multi-CDN edge POP caching without queue buffers, determining loss probability when origin bandwidth saturates.