Hello Interview · Four community designs · Cross-source overview
Book Seller Marketplace
Accept a buyer's ISBN and maximum price, identify an eligible seller, reserve inventory, coordinate payment, and complete exactly one purchase despite retries and third-party failures.
Peak10K queries/s
Sources4 implementations
SelectionLowest price ≤ maximum
Hard invariantOne winner, one charge
Problem statement
Customers submit purchase requests containing customer information, a book identifier, a maximum acceptable price, and payment information. Registered sellers expose different APIs. The platform finds the lowest eligible offer and initiates a purchase while supporting synchronous and asynchronous processing at up to 10,000 queries per second.
Tier 1 · Common architecture
- Register sellers: store endpoints, authentication metadata, capabilities, and rate limits.
- Accept and persist: validate an idempotency key, create the order, and make it durable before fulfillment.
- Dispatch asynchronously: a queue absorbs bursts while workers process at a controlled rate.
- Choose candidates: query sellers live or consult a maintained price and inventory index.
- Reserve inventory: atomically claim a platform listing or create an expiring seller hold.
- Complete one attempt: authorize, confirm, capture, and reconcile through explicit states.
Minimal interfaces
POST /sellers → seller_idPOST /orders { isbn, max_price, payment_method_token } → order_idGET /orders/{order_id} → status, seller, priceseller: quote · hold · confirm · releaseShared data model
seller(id, endpoints, auth_ref, rate_limit, status)order(id, user_id, isbn, max_price, status, listing_id)listing(id, isbn, seller_id, price, status, held_by, hold_expiry)hold(id, order_id, seller_id, held_price, expires_at, status)payment(id, order_id, provider_ref, amount, status)
Design center
Relational authorityOrders, listings, and reservations fit one transactional model. The claim and order transition share one short transaction.
Rate shapingAPI peak, average event rate, and database transaction rate are separate quantities. Queue capacity follows backlog and drain-time targets.
Partition keysPurchase work uses order ID for distribution. Inventory events use ISBN for per-book ordering. The database arbitrates listing contention.
Idle demandUnmatched orders enter
WAITING_FOR_INVENTORY. New-listing events wake bounded work and prevent replay loops.PaymentsCard data is tokenized by the payment processor. Authorization, capture, refund, and reconciliation have distinct states.
Recall test
- Which durable operation happens before fulfillment begins?
- How does 10K API QPS translate into database TPS?
- Which queue key distributes purchase work evenly?
- What event wakes an unmatched order?
- Which payment event moves money?