Drain Without Drowning
Easy · system design problem
A seller bulk-upload floods the order queue for 90 seconds. The workers must catch up within 100 seconds — and their autoscaler is about to drown the database shoppers read from.
orders-api queues writes to Kafka and serves shoppers’ reads straight from Postgres; order-workers consume the queue and write to the same Postgres, autoscaling on CPU up to 24 instances. At T+20s a marketplace seller bulk-uploads its catalog: seller writes jump 8× for 90 seconds. Queued work may be at most 100 seconds behind. Postgres must keep serving shoppers’ reads, leaves room for about 12,000 writes/s next to them, allows 150 connections and cannot change size today.
Topics
More
Codelays runs in your browser: turn on JavaScript to use it.