v0.1.0 · Single Rust binary · Apache-2.0

Kaanal is a single binary that pretends to be your backend.

Mocks, chaos and load simulation. All in one.

Serve OpenAPI mocks with realistic data, multi-hop gateway → service → cache → database timing, live chaos, and what-if load simulation — from one kaanal.yaml and one local port.

$kaanal demo
Starts an interactive shop with 24 products, auth, payments and a live chaos bar.
Scenario:
Click any node to cycle: healthy → +450ms → downseed: 42 · deterministic
Per-hop waterfallHTTP 200 · 10.2 ms
nginx.proc
0.8ms
net (gw→shop)
0.7ms
shop.proc
3.3ms
cache.miss
0.4ms
net (shop→db)
1.2ms
db.read
3.8ms
x-kaanal-trace: nginx.proc=0.8ms,net=0.7ms,shop.proc=3.3ms,cache.miss=0.4ms,net=1.2ms,db.read=3.8ms
Response (en-IN)r04f2-0001
{
  "id": 42,
  "firstName": "Siddharth",
  "lastName": "Rao",
  "email": "siddharth.rao81@example.com",
  "phone": "+91 9385785563",
  "city": "Kochi",
  "state": "Kerala",
  "pincode": "682001",
  "status": "active"
}
Three jobs, one engine

Mock, break, and size on the same cost model

Traditional mock servers reply in 0 ms, hiding spinners, timeouts and retry storms. Kaanal shares one topology and replay engine across live mocks and virtual-time simulation.

01 · MOCK

Coherent data, real hop timing

Generates schema-validated JSON with matching names, emails, addresses and locales (en-IN, en-US, de-DE and 4 more), delayed by the actual hop chain behind each route.

02 · BREAK

Live chaos, scenarios & pins

Inject latency, 5xx errors, TCP resets, malformed bodies, hangs, or rate limits at any node or route. Stack named scenarios with TTLs, or cycle UI states with kaanal cycle.

03 · SIMULATE

Find the knee before users do

Sweep traffic until p99 or errors cross your SLO, inspect per-node queues and wire bandwidth, and run kaanal sim plan to compare cloud sizing estimates.

Breaks first
db at 125 req/s
Offered load
140 req/s
System p99
2.47 s
Goodput
125 /s
Turned away (503)
15 /s
140 req/s
Database copies1
Cache hit ratio0%
nginx6% busy
140 arr/s · 256 slots · 1 ms
shop44% busy
140 arr/s · 8 slots · 25 ms
cache0% busy
0 arr/s · off (0% hit)
dbSaturated
140 arr/s · 1 copy × 4 pool slots · 32 ms

Illustrative queueing preview. In Kaanal, kaanal sim sweep and Studio run the full discrete-event engine over your exact kaanal.yaml, including queues, timeouts, retries, breakers and cloud cost estimates.

File-first & scriptable

One Git-diffable YAML file, Studio UI, CLI and HTTP control API

Edit kaanal.yaml by hand or visually on the Studio canvas. Drive the exact same running instance from your terminal, Playwright tests, or CI scripts.

kaanal.yaml
version: 1
seed: 42
port: 8080

nodes:
  nginx:
    type: gateway
    flavor: nginx
    proc: { p50: 1ms, p99: 3ms }
  app:
    type: service
    spec: openapi.yaml
    proc: { p50: 5ms, p99: 20ms }
  db:
    type: database
    flavor: postgres
    ops:
      read:  { p50: 4ms,  p99: 20ms }
      write: { p50: 8ms,  p99: 40ms }
      scan:  { p50: 30ms, p99: 150ms }

edges:
  - { from: nginx, to: app, net: { p50: 1ms, p99: 2ms } }
  - { from: app,   to: db,  net: { p50: 1ms, p99: 2ms } }

endpoints:
  "GET /health": { override: { status: 200, body: { ok: true } } }

traffic:
  steady:
    rps: 80
    journeys:
      - { endpoint: "GET /users/{id}", weight: 1 }
Boot a stack from one command and inspect every hop.
# Run the built-in shop with a live chaos bar
kaanal demo

# Or generate kaanal.yaml from your own OpenAPI 3.0 file
kaanal init openapi.yaml
kaanal up -d
curl -i http://localhost:8080/users/42
Topology primitives

Nine infrastructure nodes, acyclic by construction

Compose monoliths or multi-tier microservices with concurrency limits, connection pools, NIC bandwidth, retries, circuit breakers and replicas.

Nodes reference →
gateway

Optional reverse proxy or API gateway (nginx, Envoy). Pays proc first and hosts static endpoints.

service

Backend microservice backed by an OpenAPI 3.0 spec, with slots, queues, CPUs and retries.

monolith

Service with inline read/write/scan ops, or outgoing database edges, or both together.

database

Behavioural store with read/write/scan latencies, connection pools and flavor presets.

cache

Redis or Memcached hit/miss model. Fails open on chaos so misses fall through to the database.

external-api

Third-party HTTP dependency with its own latency, baseline error rate, pool and token bucket.

auth

Local RS256 identity provider: serves signed JWTs on POST /login and keys at /.well-known/jwks.json.

load-balancer

Distributes calls across targets with round-robin, random, weighted, least-conn or p2c balancing.

storage

Object store (S3, GCS, Blob) modelling first-byte latency, byte throughput and request limits.

100% deterministic for a seed

Same seed produces the same response bodies and sequential failure patterns locally and in CI.

Local-first & locked down

Binds 127.0.0.1 by default, guards control routes with a 256-bit Bearer token and Host checks, and makes zero outbound calls.

Synthetic data only

No real-person datasets are bundled; generated emails always use @example.com (RFC 2606).