I Ran NATS JetStream as Our Only Queue for 90 Days — Week Six Almost Sent Everything Back to…
Kafka felt like hiring a second company. Zookeeper ghosts, partition math, rebalancing drama — for a team shipping ~12,000 jobs/hour at peak. Not nothing. Not Netflix.
We picked NATS JetStream for order fulfillment events: paid, packed, shipped, refunded. One cluster, three nodes, replication factor 3, subjects per domain. Postgres remained source of truth. JetStream was the async nervous system.
Ninety days later: $4,200 less in managed Kafka we’d been quoted, one weekend we’d like to forget, and a migration calendar entry that now blocks deploys.
Why JetStream and not Kafka (this time)
Requirements:
- At-least-once delivery with idempotent consumers
- Peak ~200 messages/second, average ~40
- Retention 7 days for replay during bug fixes
- Team of 8 engineers — no dedicated streaming SRE
JetStream pitch we believed:
- Ops simpler than Kafka for our scale
- Built-in persistence, consumer groups, replay
- Small footprint — our three-node cluster averaged ~1.2GB RAM each under load
What we didn’t model hard enough: schema migration weekends + consumer lag + subject explosion from a feature flag mistake.
Days 1–30 — the honeymoon
Consumers in Go — one binary per domain, AckExplicit, max deliver 5, backoff on failure. DLQ subject orders.dlq with alert on any message.
Metrics we watched:
- Publish rate, consumer lag, stream byte size
num_pendingper consumer- Disk usage on JetStream store (PVC 20GB per node)
Week two load test: 5× peak for 20 minutes. Lag peaked at ~8,000 messages, cleared in ~6 minutes. Good enough.
Cost vs quoted Confluent Cloud for same throughput envelope: ~$380/month self-hosted on small VMs vs ~$690/month quote. Not the only reason — ops simplicity counted — but finance noticed.
Consumer design we thought was bulletproof
Each consumer:
_, err := js.Subscribe("orders.shipped", handler, nats.DeliverNew(), nats.ManualAck())
_, err := js.Subscribe("orders.shipped", handler, nats.DeliverNew(), nats.ManualAck())
Idempotency key in Postgres fulfillment_events(event_id PRIMARY KEY). Handler acks only after commit. Textbook.
What textbooks skip: v2 subject with different JSON casing — orderId vs order_id. Half of consumers normalized; half didn’t. Dual-publish without schema contract testing is two queues pretending to be one.
We added contract tests in CI — publish sample payloads from both versions, assert all consumers process without DLQ. 14 failures the first run. Embarrassing. Cheaper than ~180 manual order fixes.
Week six — hour by hour (short version)
Time What happened Fri 16:10 Deploy + flag typo Fri 18:00 Lag ~40k — within “normal Friday” noise Fri 23:00 Support slack: “tracking stuck” — 3 tickets Sat 06:00 Lag ~400k — dashboard finally opened Sat 08:30 Rollback decision Sat 14:00 Lag cleared, manual fixes start Mon Postmortem, calendar rule
Total engineer-hours weekend: ~38. Kafka wouldn’t have prevented YAML indentation. It might have had better tooling — might have cost more sleep anyway.
Week six — the migration that ignored the queue
Friday deploy: add orders.v2.shipped subject alongside orders.shipped. Feature flag would dual-publish for 48 hours. Classic.
What happened:
- Flag stuck at 100% v2 in staging config copied to prod (YAML indentation — the real villain)
- Only v2 published; half of consumers still subscribed to v1
- Lag climbed ~400k messages over 9 hours before anyone checked JetStream dashboard (Grafana panel was on page 3)
- Fulfillment DB writers fell behind — read models stale — support tickets +37% Saturday morning
We considered replaying into Postgres batch tables and rebuilding consumers from scratch. Estimated ~14 hours downtime for correct order state. Nope.
Rollback path:
- Freeze publishes at edge
- Scale consumers 4× temporarily
- Replay v2 → v1 mapping in a one-off script (~2,100 lines of ugly, 6 hours)
- Feature flag fix + dual-publish actually enabled
Customer-visible wrong shipment states: ~180 orders needed manual correction. Estimated cost ~$9,400 between refunds and ops overtime.
→ 30 Production Incidents That Cost $10K+ — queue lag, dual-write mistakes, and the weekends where “simpler than Kafka” still pages you.
What we fixed permanently
Migration calendar
- No schema/subject changes Friday after 14:00
- JetStream changes require consumer group checklist sign-off
Lag alerts
num_pending > 10,000for 5 minutes → page- Dashboard on page 1 beside Postgres replication
Subject governance
- Max 2 active versions per domain
- CI test: consumers exist for every publish subject in prod config
Replay runbook
- Documented
nats stream view, snapshot restore, consumer reset — practiced once in staging (quarterly)
Days 31–90 — what actually broke (besides week six)
Smaller fires we didn’t post about:
- Disk pressure on node 2 — stream ~16GB, retention not trimming fast enough during replay test. Raised PVC to 40GB, added disk alert at 75%.
- Slow consumer on refunds — poison message from bad JSON ~1,200 retries before DLQ. Added schema validation at publish edge.
- Holiday traffic dip — consumers scaled down on HPA; Monday surge lag ~22k for 40 minutes. Not an outage. Looked like one in Grafana.
JetStream ops at our scale: ~2–4 hours/month meaningful on-call. Kafka quote implied either $690/month managed or ~1 FTE fractional if self-hosted “properly.” We weren’t Kafka-sized. We also weren’t zero-ops.
Postgres didn’t save us either — and that was the point
Week six, someone said “let’s just poll Postgres.” We already did for source of truth. The queue wasn’t about durability alone — it was decoupling fulfillment writers from checkout spikes. Postgres LISTEN/NOTIFY doesn’t replay 400k missed events without a migration script anyway.
What Postgres did give us during recovery: idempotency table fulfillment_events let us dedupe replays. Without that, JetStream replay would have double-shipped. The lesson wasn’t “queues bad” — it was every async boundary needs the same migration discipline as schema.
We added a queue change row to the same calendar as DB migration — same approvers, same “no Friday” rule, same rollback section in the PR template.
Monitoring layout we copied from the DB team
DB replication dashboard sits top-left on the NOC wall. We moved JetStream to the same row:
- Stream byte size, consumer pending, publish rate
- Red line when pending correlates with replication lag >5s
Correlation saved us twice after week six — lag spikes from DB, not NATS, looked identical in support tickets (“where’s my order?”). Teaching support to check both panels cut false escalations ~30%.
Load test we should have run before prod
Post-week-six, we replayed Friday deploy + flag typo in staging:
- Dual-publish misconfigured ~40 minutes before alert fired in old dashboard layout
- New layout: alert at ~6 minutes
- Replay cost: ~4 engineer-hours — cheaper than ~38 the first time
We also tested single-node NATS loss — JetStream RAFT elected new leader in ~8 seconds, ~1,200 messages redelivered, zero duplicates thanks to idempotency keys. Good story for leadership. Doesn’t replace migration calendar discipline.
Finance recap — ninety days in one table
Metric JetStream (actual) Kafka quote (same envelope) Infra cash ~$380/mo self-hosted VMs ~$690/mo managed quote Engineer on-call (meaningful) ~2–4 hrs/mo unknown (avoided) Week six cost ~$9,400 visible + ~38 eng-hrs wouldn’t have prevented YAML Replay drills after quarterly —
JetStream won cost and ops at our scale. It did not win forgiveness for skipping queue migration rules. Postgres remained truth. JetStream remained nervous system. Both need adult supervision.
When JetStream stays
- Our scale (tens of thousands/hour, not millions/sec)
- Teams that want one binary and acceptable ops
- Workloads with clear subject boundaries
When we’d revisit Kafka
- Strict ecosystem requirements (Flink, heavy stream processing)
- Multi-tenant isolation at hundreds of topics
- Compliance needs managed vendor attestation
What you should do this week
- Graph consumer lag next to DB replication lag — same wall.
- If you dual-publish, test the flag stuck scenario — not just happy path.
- Put JetStream disk and pending metrics above the fold.
- Schedule queue-impacting migrations like database migrations.
- Run one replay drill before you need it.
Simpler than Kafka isn’t simpler than physics.
→ Redis War Room — queue backlog patterns overlap with cache/consumer storms; emergency triage when throughput hits zero.
Froquiz drills microservices and messaging scenarios — not “what does NATS stand for.”
→ Froquiz
