</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 5: The Row That Holds the Secret - Data Modeling

Executive Summary: Section 4's contract promises a definitive verdict in one round trip and swears never to reveal a maximum. Both promises are kept by a data model with two load-bearing objects: an auctions row that holds the high bidder's secret high_max_amount beside the public price, and an append-only bids ledger keyed by (auction_id, seq), where seq is assigned under the same lock and is the tiebreaker. Everything else is a projection built from events. We list the six access patterns first, lay out the tables, trace auction #7731's row through Marcus's Tuesday bid, Elena's Thursday bid and the Sunday tie, size the ledger from the numbers, and defend sharding by auction_id across 32 shards against sharding by bidder or by end time.

The interviewer taps the whiteboard where Section 4's POST /auctions/{id}/bids is still written. "Walk me through what that request touches. Tables, keys, who owns what."

Resist the urge to draw boxes labelled users and items. A model is a set of answers to specific questions, so start with the questions the ledger already told us.

Access Patterns Before Tables

Pattern Keyed by Load it must carry Consistency
Place a bid: read row, validate, append, update auction_id 5,000 bids/s system-wide; 200/s on one hot row Linearisable per auction
Read auction state auction_id 35,000 reads/s at peak Fresh to the last accept
Bid history auction_id, ordered by seq Page-shaped Prices only, never maxes
"My bids", "items I'm watching" bidder_id Modest Seconds of lag is fine
Find auctions that are due (status, end_time) per shard 1,600 closes/s in the worst minute At-least-once, idempotent
Watchers of an auction auction_id 50,000 for the hot item Eventual

Five of the six are keyed by auction_id. That one observation decides the partition key, co-locates everything the accept transaction touches, and leaves exactly one pattern, the bidder-keyed one, to be served another way.

Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.