Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

incident.io 9 min read Case study mediumAdept

Keep the monolith, but split the workloads

A Go monolith can get much of the reliability isolation of microservices by splitting workloads into separate deployments of the same binary, instead of breaking it into services. After a bad Pub/Sub message caused an unhandled panic that crashed the web, worker and cron threads together for 32 minutes, incident.io split them into independent Heroku dyno tiers selected by command-line flags. They also gave each class of work its own capped Postgres connection pool and statement timeout, so low-priority jobs such as BigQuery event export or best-effort nudges fall behind rather than exhausting the shared database. The main migration hazard is code that assumes a shared process, such as process-local caches, and the fix is to move that coordination into Postgres or Redis.

Related posts

  • Parallel Run Pattern - A Migration Technique in Microservices Architecture

    Zalando Engineering mediumAdept

    Zalando's Returns team extracted returns logic from a legacy monolith into a new microservice using the Parallel Run pattern. After responding to the client, the monolith asynchronously POSTs the original request and its response to a /consistency-checks endpoint, which replays the request locally and compares status, headers and body, emitting matched/unmatched/failed metrics to Prometheus and Grafana. Each endpoint had its own consistency threshold, and traffic was switched one endpoint at a time via the Skipper proxy, which also made rollback a proxy config change. Tradeoffs include roughly doubled load, tricky comparisons (headers, ordering, PDFs), GDPR handling of captured data, unsuitability for non-idempotent endpoints, and significant setup and cleanup effort.

  • Production Postgres on Railway: From First Deploy to High Availability

    Railway mediumAdept

    Railway Postgres can grow from a single private-networked database to a production setup with volume backups, point-in-time recovery, PgBouncer connection pooling and Patroni-based high availability, demonstrated with an orders API that uses idempotency keys so retries stay safe. PITR restores into a separate service for validation, and the guide stresses measuring RPO/RTO end to end, including validation and reconnection time. Transaction pooling breaks session settings, LISTEN, advisory locks and named prepared statements, so migrations should use an unpooled URL. In one small planned switchover test (primary, two replicas, etcd, HAProxy), writes were interrupted for about 17 seconds. That is a single observation, not a guaranteed failover time.

  • Intermittent downtime from repeated crashes

    incident.io mediumAdept

    A poison-pill Pub/Sub message crashed incident.io's Go monolith on Heroku repeatedly, causing 13 minutes of downtime over 32 minutes. The root cause was an unhandled panic inside goroutines spawned by the Google Cloud Pub/Sub client's Receive method, which a parent goroutine's recover() cannot catch. Debugging was slowed because Go's full goroutine stack dumps overwhelmed Heroku's log rate limits, and the abrupt exit also killed Sentry reporting. The team recovered by purging suspect subscriptions, then added a recover inside the message handler and split web, worker and cron work into separate Heroku dyno tiers so worker crashes can't take down request serving.

  • Scaling PostgreSQL to power 800 million ChatGPT users

    OpenAI mediumAdept

    OpenAI serves millions of queries per second for ChatGPT and its API from a single unsharded Azure PostgreSQL primary plus nearly 50 geo-distributed read replicas, despite load growing more than 10x in a year. The approach is to keep the primary as idle as possible: move shardable write-heavy workloads to Azure Cosmos DB and ban new tables, push reads to replicas, kill expensive ORM-generated joins, and isolate high- and low-priority traffic onto separate instances. Supporting measures include PgBouncer pooling (connection time down from 50 ms to 5 ms), cache leasing to stop miss storms, multi-layer rate limiting with query-digest blocking, and schema changes capped at a 5-second timeout. The result is low double-digit millisecond p99 latency, five-nines availability and one SEV-0 in 12 months, and cascading replication is being tested to scale past 100 replicas.

  • Service disruption on October 20, 2025

    incident.io mediumAdept

    The October 20, 2025 AWS us-east-1 outage degraded incident.io through third-party dependencies even though it runs on Google Cloud: its transcription, SAML, telecom and status page providers were all affected. Delayed SMS and phone notifications cascaded because notification queues shared worker capacity, and slow retries stretched jobs to 30s. Fixes were blocked by a hidden Docker Hub base-image dependency in the deploy pipeline. Scaling escalation workers made things worse because dead tuples in a Postgres index made queue acquisition consume about 50% of worker capacity, and a rate-limiter bug applied limits only to the top 10 organisations. Remediations include a self-contained GCP build pipeline, region failover for Scribe, aggressive autovacuum, reworked acquisition logic, and per-provider isolated notification workers.

The quest for software engineering knowledge.

Look:
Layout: