Building blockOfficial
Reservation with a TTL, and a Unique Constraint
A short-lived hold makes checkout feel fast; a unique constraint in the database is what actually makes double-selling impossible.
The design library
Building blocks, complete architectures, and variations worth comparing. Search by the problem you want to solve or a component you want to understand.
Building blockOfficial
A short-lived hold makes checkout feel fast; a unique constraint in the database is what actually makes double-selling impossible.
Building blockOfficial
Positions written to a cell-based index with a short expiry, so "who is near me" is a small read and anything that stops reporting disappears on its own.
Building blockOfficial
Dumb servers hold the sockets, a registry maps each online user to the one holding theirs, and the logic lives behind both.
Building blockOfficial
A table of things due later, a sweeper that claims the ones due soon, and a delay queue that holds each until its moment.
Building blockOfficial
The caller names the operation, the server stores the first response under that name, and a retry replays it instead of doing the work twice.
Building blockOfficial
A bucket of tokens per key, refilled at a fixed rate, with refill-and-take done atomically in one place so every server agrees.
Building blockOfficial
Push new items into followers' timelines at write time, except for accounts with huge followings, whose posts are pulled and merged at read time.
Building blockOfficial
Write the row and the event it should publish in one transaction, then relay the event, so a commit and its message can never disagree.
Building blockOfficial
The service reads the cache first and fills it on a miss, so the cache holds only what is actually asked for and an outage degrades to slow rather than down.