Replicas Don’t Take Writes
Easy · system design problem
A flash sale triples orders for 90 seconds. MySQL’s primary is the only node that can write — and it has 151 connections.
orders-api writes orders to a MySQL primary and reads through two replicas. At T+30s a flash sale triples traffic for 90 seconds; writes cost three times a read and only the primary can take them. MySQL allows 151 connections (orders-api uses 80). Orders may be fulfilled up to two minutes after they are accepted, but every one must be accepted. Orders are individual records: they cannot be aggregated.
Topics
More
Codelays runs in your browser: turn on JavaScript to use it.