1M Durable Workflows per Second on Postgres
Sharding Postgres with PgDog let DBOS durable workflow throughput scale linearly from 20K workflows/sec on one db.m7i.4xlarge RDS instance to 1M workflows/sec across 50 shards. Linear scaling depends on every workflow operation hitting a single shard, so a shard_key column is added to workflow_status and all dependent tables, and workers dequeue one shard at a time. Past roughly 8-16 shards, performance turned metastable: a briefly slow shard (e.g. during VACUUM) attracted more concurrent FOR UPDATE SKIP LOCKED dequeuers, and the resulting lock contention made the shard slower still until the whole cluster collapsed. The fix caps concurrency per shard with a small pool of Postgres advisory 'dequeue locks', and a worker that cannot get one skips to the next shard instead of waiting.
Related posts
- What's New in DBOS - October 2026
DBOS mediumAdeptDBOS Transact adds workflow rewind to any step, which discards checkpoints from that step onward and re-executes while preserving the workflow ID. It also adds ownership tokens, verified in the same transaction as each checkpoint write, so zombie executors stop at their next checkpoint instead of overwriting recovered workflows. A new commercial Enterprise extension now holds the Conductor client and adds automatic workflow version upgrades, coordinated with Postgres advisory locks and a grace period for running workflows. It also adds horizontal scaling over sharded Postgres: a shard_key colocates each workflow's state on one shard, and benchmarks show linear scaling past 1 million workflows per second.
- You should shard your database
PgDog mediumAdeptSharding Postgres early avoids the operational pain of large single instances, illustrated by an outage where stale planner statistics caused a 300 GB table to be sequentially scanned. Attempts to fix it by raising default_statistics_target added planning time (0.2ms to ~1ms per query, significant at 100k QPS), while making autovacuum analyze more often increased IOPS. Splitting the table into 12 shards cuts writes, autovacuum work and scanned rows by 12x, making migrations like ALTER COLUMN TYPE BIGINT finish in seconds and lowering the cost of mistakes.
- How savepoints quietly throttled our Postgres queue
incident.io hardMasterUsing a SAVEPOINT per tick in a Postgres-backed job queue made every locked row carry a MultiXact ID in xmax. FOR UPDATE SKIP LOCKED scans then contended on the LWLock-guarded pg_multixact cache, so adding workers made acquisition slower. incident.io fixed it by moving the queue to a slim escalation_jobs table, replacing subtransactions with a claimed_until lease (one transaction per tick), keeping claimed_until unindexed with fillfactor 85 to allow HOT updates, and running one dispatcher goroutine per pod that feeds workers over a channel. Together these raised peak escalation capacity 3.5x, at the cost of up to 10 seconds of delay if a pod dies mid-claim.
- Running Durable Workflows in Postgres using DBOS
Supabase mediumAdeptDBOS implements durable workflows entirely in Postgres: workflow and step decorators record a workflow's ID, inputs and status in a workflow_status table and each step's output in operation_outputs, all within a separate system database. On restart, a background thread re-runs PENDING workflows with their original inputs and skips steps whose outputs are already stored, so execution resumes from the last completed step. This relies on workflows being deterministic. Because a step transition is a ~1ms Postgres write rather than a ~100ms external dispatch, DBOS claims 25x the speed of AWS Step Functions, and it offers exactly-once transactional steps and idempotency keys used as workflow IDs.
- How Figma’s databases team lived to tell the scale
Figma mediumAdept
Figma horizontally sharded its RDS Postgres stack after vertical partitioning ran out of room. Multi-terabyte tables were hurting vacuum reliability and approaching RDS IOPS limits. Instead of moving to CockroachDB, TiDB, Spanner, Vitess or NoSQL, the team built sharding on its existing Postgres fleet using several pieces: colocated table groups ("colos") that share a shard key such as UserID, FileID or OrgID; hash-based routing to avoid hotspots from auto-incrementing and Snowflake IDs; logical sharding via views, kept separate from physical shard splits; and a DBProxy query engine that parses and routes queries and also does load-shedding and request hedging. Deliberate tradeoffs included dropping atomic cross-shard transactions, accepting slower range scans, keeping rollback possible, and using full logical replication. Sharding the first table took nine months.