Practice: Online Auction
Run a 40-minute self-guided auction design session. Define bid acceptance, deadline rules, winner selection, and payment recovery.
Run a 40-minute self-guided auction design session. Define bid acceptance, deadline rules, winner selection, and payment recovery.
Write your own design before opening hints or the solution review. The numbers below are exercise assumptions, not claims about any company’s production traffic. You may challenge an assumption, but record the replacement and explain which decision changes.
Scenario and constraints
- 100,000 active auctions; one hot auction gets 5,000 bid attempts/s.
- Server-defined close time; no anti-sniping in the baseline.
- Live high-bid display may lag one second.
- One authoritative winner; payment can time out.
Your deliverables
- Minutes 0–7: state deadline, reserve-price, and tie rules.
- Minutes 7–17: model bids and atomically serialize bid/close decisions.
- Minutes 17–30: draw live display and a durable winner workflow.
- Minutes 30–40: recover a missed close job and an unknown payment.
Reason about this sequence
Read the diagram
Auction open at version 20 → Final bid and close race → Owner applies deadline rule → One close outcome commits → Payment proceeds separately
For every step, annotate what is durable, what the caller knows, and which identity survives a retry. Identify the point where two concurrent actors could disagree. Do not assume a timeout means failure or a cache value grants ownership.
Interviewer follow-ups
- At minute 17, a final bid races the close worker.
- At minute 28, the scheduler misses the deadline.
- At minute 35, a delayed payment event arrives twice.
Answer each follow-up using the same design first. If it breaks, change the smallest boundary that repairs the invariant and explain the new cost. Show whether the change adds latency, storage, coordination, or operational work.
Staged hints
Hint 1 — reveal
Answer: Hint 1 — Bid and close must meet at the same decision boundary. A browser clock or event arrival order at the UI cannot select the winner.
Hint 2 — reveal
Answer: Hint 2 — Store auction state, deadline, current high bid, and version at the authoritative owner. Accept a bid only if the auction is open, the amount exceeds the current qualifying bid, and the deadline rule holds. The close transition uses the same authority so a concurrent bid and close have one well-defined order.
Hint 3 — reveal
Answer: Hint 3 — A scheduler crashes just before closing. The auction must not remain open forever. Request-time deadline checks reject late bids, while a recovery scan finds overdue open auctions and runs idempotent closure. If the winning payment fails, use a stated business policy such as retry, cancellation, or offering to another bidder; do not silently invent a new winner.
Evidence-based self-review
- The bid deadline uses an enforceable authoritative rule.
- Close retries cannot produce multiple winners.
- Live display is separated from acceptance authority.
- Payment and missed scheduling have explicit repair paths.
Score each item 0 if absent, 1 if named without an enforceable mechanism, or 2 if the mechanism and a failure are explained. Record evidence from your own diagram beside the score. Then choose one weak decision, revise it, and repeat the relevant follow-up. This rubric is a learning tool, not a hiring forecast.
Clarify this prompt before choosing components
Ask the highest-impact questions first, agree on priorities, and record the interviewer’s answers. If a detail is unspecified, state an assumption and explain which decision depends on it. The numbers in this worked lesson are exercise assumptions, not company facts.
| Ask the interviewer | Why the answer changes the design |
|---|---|
| Hard close, extended close or buy-now? | Time and extension rules change bid acceptance. |
| Tie-breaking, minimum increments and simultaneous bids? | Serialize authoritative conditional updates and define deterministic winners. |
| Payment failure or bid cancellation after winning? | Winner selection and settlement have separate states and compensation. |
Use the Interview Playbook for the shared 45-minute sequence and fresher, intermediate, senior and staff evidence. Start with one complete operation. Extend the answer with the failure/recovery traces below, then defend a workload-specific alternative and a measurable rollout. Scope and evidence matter more than a large component list.
Reveal the full worked solution
Save your attempt before continuing.
Online Auction: Understand the building blocks
Choose a mechanism because it satisfies a requirement. These explanations describe the exercise design, not undisclosed implementation choices at the named company.
Online Auction: Quick vocabulary
| Term | Meaning and role in this exercise |
|---|---|
| API: Application Programming Interface | The contract for requests, responses and errors between components. An API route does not itself enforce every business invariant. |
| SQL: Structured Query Language | A language for querying/manipulating relational data. Correctness still depends on constraints, transactions and isolation choices. |
| PK: Primary Key | The declared row identity in a database schema; it does not automatically enforce every cross-row business rule. |
Online Auction: Compare-and-set (CAS) and optimistic concurrency
What it means: A conditional write changes state only if an expected version or value still matches. The comparison and write share one atomic boundary.
Why this problem needs it: Concurrent bids must compare with one current auction state.
How to use it: Carry the version read by the caller; atomically compare, mutate and advance it. On conflict, re-read or reject under the business policy.
Example in this design: A stale expected revision cannot overwrite an accepted higher bid.
When it fits: Useful when concurrent requests must not silently overwrite the same owned state.
Alternative and limits: Row locks or a serial owner can simplify highly contended updates. A read followed by an unconditional write is not CAS.
Online Auction: Lease, ownership epoch and fencing
What it means: A lease grants temporary work ownership. A fencing token or epoch identifies a newer owner so stale owners can be rejected at the mutation boundary.
Why this problem needs it: Only the current auction owner may decide the ordered close boundary.
How to use it: Claim a job under an atomic authority, increment its attempt/epoch, and require that value on result publication. The protected resource must enforce the check.
Example in this design: A newer owner epoch rejects publication by a resumed former owner.
When it fits: Useful when workers can pause, restart or overlap after a timeout.
Alternative and limits: A non-expiring lock risks blocking forever. Lease expiry alone cannot stop an old process that resumes; external effects need their own supported idempotency/reconciliation.
Online Auction: Durable work queue and backpressure
What it means: A queue separates accepted work from execution. Backpressure limits admission or consumption when downstream capacity is finite.
Why this problem needs it: Events can be delivered asynchronously after an authoritative bid commit.
How to use it: Persist a stable job identity, consume with bounded concurrency, acknowledge after the required durable transition, and cap retries/backlog according to policy.
Example in this design: A notification replay must not reopen bidding or change the accepted owner order.
When it fits: Useful for asynchronous work that must survive worker failure or absorb a finite burst.
Alternative and limits: A synchronous call is simpler for short bounded work. A queue does not create capacity, strict global ordering or exactly-once external effects.
Interview scope and guarantees
Create an auction, place bids, display the current leading bid, close at a defined time, and settle the winner. Define proxy bidding, tie rules and anti-sniping extensions before designing. The accepted bid order must be authoritative.
Capacity worksheet
Assume 10,000 active auctions and 100,000 bids/minute: about 1,667 bids/s average. A single celebrity auction can dominate the total. If one serialized bid transaction takes 5 ms, one owner processes roughly 200/s before queueing; that hot-auction limit matters more than aggregate shard count.
Concrete API contract
POST /auctions/{id}/bids {amount,currency,clientBidId}
GET /auctions/{id}
GET /auctions/{id}/events?after=...
POST /auctions/{id}/close {expectedGeneration}Data model and access paths
auctions(id PK,state,closes_at,highest_bid_id,version)
bids(auction_id,sequence,bid_id,bidder_id,amount,accepted_at)
bid_keys(bidder_id,client_bid_id,bid_id)
settlements(auction_id UNIQUE,winner_id,payment_ref,state)Evolve a solution and explain each change
Read the diagram
Serialize bids / Store accepted bids against an auction’s current price and deadline. / Reading the price and then writing can admit invalid concurrent bids.; Commit closure / Use the same authority for bids and auction close with server time. / A delayed worker can close after the displayed countdown reaches zero.; Deliver live views / Stream committed bid/close events and reconcile payment separately. / Socket arrival order must not define the winning bid.
Step 1: Serialize bids
Store accepted bids against an auction’s current price and deadline. Reading the price and then writing can admit invalid concurrent bids.
Step 2: Commit closure
Use the same authority for bids and auction close with server time. A delayed worker can close after the displayed countdown reaches zero.
Step 3: Deliver live views
Stream committed bid/close events and reconcile payment separately. Socket arrival order must not define the winning bid.
Responsibility overview
Read the diagram
Bidder to Bid API: submit bid identity; Bid API to Auction DB: serialized bid admission; Auction DB to Bid event log: committed bid event; Close worker to Auction DB: close by deadline; Close worker to Payment provider: settle winning order; Bid event log to Bidder: live bid update
Worked end-to-end scenario
Auction A currently has bid 100. Two bidders submit 110 and 120. The authority validates and commits them in its defined serialization order; an equal or lower amount can be rejected under the increment rule. At close, the transaction establishes the winner from accepted state and prevents later bid admission. A client packet sent before the countdown but received after the authoritative deadline follows the stated admission policy, not its device clock. The winner’s payment is a separate workflow. If collection fails, record the outcome and apply the auction policy rather than retroactively altering the bid history.
Why these access paths matter
Use auction ID as the serialization domain; bids need immutable identity, actor, amount, and accepted order. Index auctions by closure deadline for scheduling, but validate the deadline in bid admission even if the closer is late. Persist close results and notification intents together. Money uses integer minor units or an exact decimal model, not floating point.
Build the baseline first
Read the diagram
Bidder → auction owner → transactional bid acceptance; Committed bid → event log → live viewers; Authoritative close → winner record → settlement
- Bidder → auction owner → transactional bid acceptance.
- Committed bid → event log → live viewers.
- Authoritative close → winner record → settlement.
Evolve the design under load
Read the diagram
Auction-key routing → independent owners; Hot auction → bounded sequential command queue; Read projection → regional fanout → viewers
- Auction-key routing → independent owners.
- Hot auction → bounded sequential command queue.
- Read projection → regional fanout → viewers.
Defend the hardest decision
Use integer minor currency units and enforce the minimum increment against the committed highest bid. Server receipt or commit order must be chosen as the acceptance rule; client clocks are not authoritative. The close command and bid commands must share an ordering boundary. If anti-sniping extends the auction, persist the new close time in the same bid transaction.
Failure and recovery analysis
A close worker retries after the winning bid was stored but settlement publication failed. The unique settlement row and outbox make recovery safe. If payment fails, apply a documented next-bidder or cancellation policy; do not silently rewrite the accepted auction history. During leader failover, fence the old owner so two leaders cannot accept incompatible winners.
Security and privacy boundary
Authenticate bidders, protect payment data, and detect abusive bidding while keeping the acceptance rules reproducible.
Interview follow-ups with reasoning
Question: Can Redis pub/sub be the bid record?
Show answer and explanation
Answer: No, viewers can miss messages; persist accepted bids first.
Question: How do you handle last-second bursts?
Show answer and explanation
Answer: Admission and queue-delay visibility plus a precise deadline policy.
Question: How do you audit disputes?
Show answer and explanation
Answer: Retain accepted and rejected decision evidence with server ordering.
Operate and verify the design
Bid decision latency, per-auction queue age, close conflicts and unresolved settlement.
Race the final bid and close command under the declared deadline rule and inspect the accepted order.
A second scenario to test transfer
At 12:00:00, a bid handler and a close worker race. The database or auction owner evaluates them under the declared deadline and ordering rule. If the bid is accepted before closure under that rule, it can become the winner. If closure wins, the bid is rejected. The client’s displayed clock and a delayed WebSocket event cannot override the authoritative decision.
Can a bid be accepted solely because the client timestamp is before the displayed close time?
Show answer and explanation
Answer: No. Client clocks and delivery delays are untrusted for the authority decision. Apply the server-defined deadline rule atomically with auction state, and return a stable accepted or rejected result for retries.
Compare alternatives
| Choice | Benefit | Trade-off |
|---|---|---|
| Single auction owner | Clear ordering | Hot-auction capacity bound |
| Anti-sniping extension | Reduces last-instant bidding effects | More complex deadline state |
| Live display cache | Fast reads | May lag accepted bids |
A design-changing exercise
The close worker is ten seconds late. Are bids during those ten seconds valid?
Show answer and explanation
Answer: Only if that is the explicit product policy. Normally bid admission checks the authoritative deadline independently of when the worker runs.
Design workshop: bids and closure share one order
Choose ascending auctions with a one-dollar minimum increment, no proxy bidding in the baseline, and a server admission rule: a bid is accepted only when its authoritative transaction evaluates before closes_at. Network send time and client clocks do not qualify. Assume bid acknowledgment under 200 ms when admitted; after overload, reject or queue under a declared rule rather than claim every pre-deadline client click wins.
Lock the auction row, verify active state/deadline/current price, persist the command result and accepted bid, and update highest bid in one transaction. Store commands(auction,actor,client_request_id,fingerprint,outcome,bid_id), unique by identity, including rejected decisions when the contract promises stable retries. A retry lookup occurs before repeating deadline checks, so an accepted bid does not become rejected after its response is lost.
The identity scope is (auction_id, bidder_id, client_bid_id). The canonical request fingerprint includes the integer amount and currency. Return a prior decision before checking the current deadline: a timeout retry of an accepted bid returns the same bid, and a retry of a rejected bid returns the same rejection. Reusing the identity with another fingerprint is a conflict. Persist a rejected decision only for the request identities covered by the API's retry contract; apply retention at least as long as the documented retry horizon.
BEGIN;
-- The unique key serializes retries for this bidder and auction.
SELECT fingerprint,outcome,bid_id FROM bid_commands
WHERE auction_id=:auction AND bidder_id=:actor AND client_bid_id=:request_id
FOR UPDATE;
-- If found, compare fingerprint and return the stored decision before checking time.
SELECT * FROM auctions WHERE id=:auction FOR UPDATE;
-- Capture database time after acquiring the serialization lock.
-- If inactive, deadline passed, or amount < highest + increment, insert a rejected
-- bid_commands row with the reason, COMMIT, and return that durable decision.
-- Apply a bounded anti-sniping extension here, if enabled, and bump generation.
INSERT INTO bids VALUES (:bid,:auction,:actor,:amount_minor,:accepted_at);
UPDATE auctions SET highest_bid_id=:bid,highest_minor=:amount_minor,
version=version+1 WHERE id=:auction;
-- Store accepted command result and bid/deadline outbox events in this transaction.
COMMIT;For the baseline, the auction has one immutable currency, and amount_minor is an integer in that currency's minor unit. The database timestamp captured after row-lock acquisition is the admission time; requests arriving at or after closes_at are rejected. A different ingress-log policy can accept a command before the deadline and evaluate it later, but then the durable ingress sequence and deadline queue budget must become part of the contract.
The close worker locks the same row and validates the current deadline and generation before freezing the winner. A late worker cannot use an old timer if anti-sniping extended the deadline. Settlement creates a stable winner/order identity and contacts the payment provider outside SQL. Failure to collect invokes a documented resolution policy; it does not silently promote another bidder without audit.
For a concrete anti-sniping policy, when an accepted bid arrives with at most three minutes left, move the deadline to max(current_deadline, accepted_at + 2 minutes), for at most ten extensions. Update closes_at, close_generation, the bid, and the outbox event in the same transaction. Increment the generation only when the deadline actually moves. A close command is valid only for the current generation and at or after its deadline. At the cap, late bids remain eligible until the current deadline but do not extend it. A request evaluated exactly at closes_at is rejected; close becomes eligible at that instant. This is an explicit policy choice, not a universal auction rule.
The row lock is the serialization point. On owner failover, fence the old owner with a monotonically increasing epoch before serving new bids. Every command carries that epoch; the database rejects stale epochs even if the old process is still running. The new owner restores the durable auction head before accepting traffic. This model assumes the epoch change and row lock are protected by one durable database authority.
Read the diagram
Bid at 11:59:59 under original noon deadline; Optional anti-sniping policy extends to 12:02; generation 8; Old timer generation 7 tries closure; Reject old generation; current deadline is 12:02; At 12:02 freeze winning bid and settlement ID; Charge stable settlement identity outside transaction
If proxy bidding is added, store each bidder's maximum privately. Current price is min(highest maximum, second-highest maximum+increment), bounded below by reserve/start price, with a declared tie order for equal maxima. For maxima A=$150 and B=$120 at $1 increment, A leads at $121, not $150. A later B maximum $160 makes B lead at $151. This extension requires bid-history semantics and confidentiality; a public highest-price field does not implement it.
Use earlier accepted maximum as the tie-break. If A and B both cap at $150, the first maximum wins and the visible price is $150. With only one maximum, the visible price is the reserve. These exact cases are worked below:
Read the diagram
Private maxima / Order or tie rule / Price calculation / Result; A $150; B $120 / A first; higher maximum wins / $120 + $1 increment / A leads at $121; A $150; B $160 / B second; higher maximum wins / $150 + $1 increment / B leads at $151; A $150; B $150 / A first; earlier maximum wins tie / Price reaches tied maximum / A leads at $150; A $150 only / No competitor / Price remains $100 reserve / A leads at $100
The live-view API is a projection of committed auction versions. A response contains a snapshot version and a replay cursor. Pages return committed events strictly after that cursor and include next_cursor and has_more; when retention has removed the requested cursor, return snapshot_required and have the client fetch a fresh snapshot before replay. Bound page size and per-auction subscriber backlog. If a viewer is slower than the retained log, disconnect it and require snapshot recovery instead of buffering without limit. The bid API never waits for every socket, and a streamed event never grants bid acceptance.
Read the diagram
Connect with cursor 60; retained history now begins at 81; Return snapshot_required because cursor 60 expired; Fetch committed snapshot at version 100; Request events strictly after cursor 100; Return bounded page 101–120 with next_cursor 120; Apply events in version order; request the next page
An admission overload policy must also be explicit: reject with a retryable overload response before accepting the bid, or durably enqueue commands in one ordered log and define which eligible entries are evaluated before the deadline. Do not acknowledge a bid as accepted merely because it entered an unbounded queue. The serial owner bounds one auction's write rate even when other auctions scale horizontally.
The reference model at examples/system-design/online_auction.py exercises the chosen baseline and proxy-price rule. Its tests cover stable accepted and rejected retries, boundary timestamps, extension generations, owner failover, competing bids, close races, and live-view recovery. It is a deterministic teaching model; production persistence, payment-provider integration, and network delivery remain system responsibilities.
Read the diagram
Transition / Condition / Result; Active -> closed / Locked authority at current deadline / Immutable winning bid or no-sale result; Closed -> payment_pending / Unique settlement/order identity / External attempt queued once; Payment_pending -> unknown / Provider timeout / Query original operation; do not charge a new identity; Unknown -> paid / Verified matching provider outcome / One settlement posting; Unknown -> failed_resolution / Definitive failure under policy / Audited cancellation or explicitly chosen next-bidder workflow
A live price stream uses committed auction versions and a replay cursor. Display can lag; it never grants acceptance. Hot auctions have a serial capacity bound, so limit in-flight bid decisions and surface overload early. Owner failover restores durable head/version and fences the old epoch before accepting new commands. Monitor command queue wait, deadline rejection, hot-auction transaction time and settlement unknown age separately.
Exercise: Client sends at 11:59:59 but its bid transaction reaches authority at 12:00:01. The deadline is noon. Is it accepted?
Show answer and explanation
Answer: No under this chosen admission rule, unless the authority had already committed an eligible extension. A different receive-before-deadline command-log policy is possible, but must specify the trusted ingress boundary and how queued commands are ordered before closure.
Requirement trace and verification
| Requirement | Implementing design block | Verification link |
|---|---|---|
| R1 — Complete the primary user journey within the stated scope. | P01–P04; P09–P10. | V1 — Exercise the successful journey and the excluded/boundary case stated in the scope. |
| R2 — Preserve the problem's authoritative data invariant under concurrency. | P05–P06; P11–P12; DD1. | V2 — Run the race/replay case below and assert the invariant at the durable authority. |
| R3 — Meet the declared scale and API behavior without unbounded work. | P05–P08; P13–P14; relevant overload deep dives. | V3 — Exercise the API errors/retry identity and recompute the workload assumption that drives partition or capacity. |
| R4 — Recover from the named failure without losing or duplicating the user-visible outcome. | P15–P16; deep dives; Operations contract. | V4 — Race two equal bids, a closing timer, and leader failover; the winner must be derivable from the committed order. |
Operational contract
| Area | Decision and signals |
|---|---|
| SLIs | Bid decision latency; per-auction queue age; close conflicts; settlement unknown age; event replay lag. |
| Overload limits | Bound command queue per auction, bid fanout, active subscriptions, and settlement/provider concurrency. |
| Recovery | Recover from the durable ordered bid log; reconcile close/winner/payment state by auction generation before settlement retry. |
| Access controls | Authenticate bidders and seller operations; audit immutable bid changes and restrict administrative close controls. |
| Dominant cost | Hot-auction serialization capacity, live update fanout, and payment settlement. |
Senior-level interviewer follow-ups
Question: A bid arrives at the close boundary while the closing worker is delayed. Which clock decides?
Show answer and explanation
Answer: The authoritative auction owner compares a server-side accepted sequence/time against the closing generation and policy. Client timestamps cannot establish order; define whether the deadline is inclusive.
Question: How do proxy bids and anti-sniping extensions interact under contention?
Show answer and explanation
Answer: Serialize bid acceptance and recompute the visible winner in one auction-owner transaction. Extension rules are applied to accepted bids only, with an idempotent close generation and auditable rejected attempts.
A 60-second design answer
I would route each auction to one authoritative owner that orders accepted bids and applies proxy-bid rules transactionally. A close generation fences late workers, while an explicit deadline policy determines boundary bids and extensions. Settlement consumes the final winner idempotently. I would measure bid contention, rejected retries, close lag, settlement uncertainty, and fairness under load.
Related concepts to revisit
Technical references
Provider idempotency contract example.
PostgreSQL transaction isolation and concurrent updates.
Commit the closing decision with the accepted bid history
Define a server-authoritative deadline D=12:00:00 and a precise comparison rule. Bid b7 is accepted at 11:59:59.900 for 100; b8 arrives at 12:00:00.100 for 120 and is late under a strict-before-D rule. The close transition selects b7 from accepted facts and publishes one terminal winner identity. A delayed network packet or client clock cannot redefine the accepted-time rule.
b7: accepted before D -> eligible, amount 100
b8: after D -> rejected, even though amount 120
close: terminal winner b7 at close version 9
replay close: same winner/versionRead the diagram
b7: accepted before D -> eligible, amount 100; b8: after D -> rejected, even though amount 120; close: terminal winner b7 at close version 9; replay close: same winner/version
Serialize the relevant bid/close boundary, preserve bid operation identities and explain deadline extension rules if the product has them. Live displayed price is a projection and can lag; the bid response reflects authoritative acceptance. Payment after winning is another workflow with uncertainty/compensation, not proof that the auction was never won.
Show answer and explanation
Answer: “Highest number seen eventually” is not the winner rule when the deadline matters. A close worker and an eligible bid race under one specified owner/time policy.
Decision review: Online Auction
Online Auction: What it is
An auction orders admitted bids against a declared deadline and durably finalizes one result.
Online Auction: Why it is needed
Reading a cached clock or sending a bid before the deadline does not establish when the owner admitted it.
Online Auction: When to use it
Use a single authoritative decision order per auction when acceptance and closure must agree; distribute unrelated auctions independently.
Online Auction: How to use it
Persist bid identity and admission state under the owner’s deadline rule. Close idempotently from accepted history, and let overdue recovery trigger the same closing operation rather than inventing a different winner.
Online Auction: Compare an alternative
An extended anti-sniping deadline is a different product rule from a hard close. Explain how a qualifying bid changes the deadline atomically if that policy is selected.
Online Auction: Worked decision exercise
The following inputs and policies are original exercise assumptions; they are not measurements or undisclosed company behavior.
Bid b7 reaches the owner immediately before close c7. Under this exercise’s owner-admission rule, their committed order determines eligibility. A request arriving after closure is rejected even if its client timestamp claims it was sent earlier.
Read the diagram
Auction owner orders admitted bids and close; Bid b7 before close c7 is eligible under policy; Client send time alone does not establish admission; Recovery runs the same idempotent close
Can a crashed close scheduler leave an auction accepting bids indefinitely?
Show answer and explanation
Answer: No under the declared deadline policy: the request path also enforces admission time, while recovery finds overdue auctions and runs idempotent finalization. An accepted highest bid and a successful winner payment are separate outcomes.
Online Auction: Check the design
Observe overdue closures, conflicting bid retries, close recovery and winner-payment uncertainty. Keep the accepted history available to explain the result.
Reserve eligibility and winner settlement
Start with the existing complete baseline. The following workshop extends its authority, evidence and recovery contract under a changed requirement. Preserve scoped operation identities and distinguish durable acceptance from completed external work.
Deep dive: the highest private maximum is not always an eligible winner
The existing auction solution already orders bids and closure under one authority, supports extension generations and explains proxy bidding. This workshop makes reserve eligibility, confidentiality, accepted retries and post-close settlement explicit. The policies are original exercise choices, not universal auction rules.
Declare start price, reserve, increments and ties separately
Use integer minor units in one currency. The public start/minimum bid and seller reserve need not be the same number. A hidden reserve is the minimum acceptable winning amount under this exercise; the platform must decide what public information reveals about it. Never apply a reserve floor that makes the displayed price exceed the leading bidder's maximum.
For a worked variant, start=100, reserve=150 and increment=10. With only A maximum=140, there is no reserve-qualified winner; do not award A at 150. With A=200 and B=160, A leads and the proxy price is max(reserve, min(A_max, B_max + increment)) = 170. With one reserve-qualified bidder, this variant charges the reserve; a start-price or reserve-met display policy is a different choice. State the rule before calculating.
Equal maxima use earlier accepted maximum revision as tie-break. A and B both at 200 produce a price of 200 and the earlier accepted maximum wins. Store each bidder's accepted revision/sequence; a later increase to match an existing maximum must not inherit an earlier, lower bid's tie priority accidentally. Bid amendments cannot lower an already committed maximum in this variant. A challenger must meet the current displayed price plus increment; an incumbent may raise its private maximum without changing the public price. When no reserve-qualified price exists, the declared start minimum applies. Retractions are separately authorized events that may change eligibility and require a new versioned calculation.
auction(id, owner_epoch, policy_version, state, start_minor, reserve_minor,
increment_minor, closes_at, close_generation, committed_head)
maximum(auction_id, bidder, revision, max_minor, accepted_sequence)
bid_receipt(auction_id, bidder, key, payload_hash, accepted_or_rejected, result)
close_result(auction_id, close_generation, accepted_head, winner,
price_minor, reserve_met, policy_version)
award(id, close_result, winner, payment_operation, state)Keep private maxima out of public projections
Authenticate bid placement and each bidder's own maximum lookup. A public stream can expose current leader/price under policy, not all private maxima, rejected confidential amounts or internal reserve fields. Cached snapshots, analytics, support exports and error messages need the same field-scope rules. Encryption alone does not repair a public payload containing private values.
A ranked maximum index is derived state. Atomically commit accepted maximum, auction head, price/deadline changes and publication intent. Recompute from the committed maximum population on recovery; do not mix a new top bidder with an old second-highest maximum. Validate resulting price against winner maximum, currency, reserve eligibility and declared increment/tie rules.
Resolve accepted intent before reevaluating the deadline
Bind a bid retry key to auction, authenticated bidder and canonical intent/policy. An identical accepted retry after closure returns its receipt, not another bid. A changed amount conflicts. A saved rejected receipt also keeps its original meaning under the documented retry contract; a new attempt needs a new key and current eligibility.
The baseline uses owner/database admission time after lock acquisition, with bids strictly before the authoritative deadline. Client send time and socket arrival are not accepted time. An ingress-log-before-deadline alternative is possible, but must order a finite admitted command population before closure and budget its drain; it cannot finalize while earlier eligible commands remain unresolved.
Deadline extension and closure share one owner transaction and current close generation. A timer carrying generation 7 cannot close after an accepted extension advanced to 8. Repeating the same accepted bid cannot extend again. The baseline's accepted-bid extension policy remains in effect; switching to extension only when public price changes is a versioned product-rule change, not an implementation optimization.
Read the diagram
Close generation 8 freezes result W → Winner payment starts as operation P → Provider response is lost → W remains closed; payment stays unknown → Reconcile P without promoting runner-up
Freeze the result before contacting the winner's provider
At close, persist the eligible accepted head, policy version, reserve-met result, winner and price. A no-reserve-met result has no eligible award under this variant even when bids exist. Finalization is idempotent under the current generation; recovery runs the same close decision. Owner failover restores that head and fences stale writers before new decisions.
Create a stable award/payment operation outside the short close transaction. The auction can be closed while settlement is pending or unknown. Query/retry the original supported payment identity; a timeout cannot justify a fresh charge or a second award to the runner-up. Different delivery of winner notifications does not change ownership.
If the winner definitively cannot settle, choose an explicit resolution policy: cancellation, relisting, or an audited second-chance award with participant consent, price rules and separate operation identity. It must not rewrite the original accepted history. Unknown payment first needs reconciliation so the first winner cannot be charged after another buyer was awarded the same item. Revocation of an award and refund/compensation have separate durable states.
Bound one hot auction and its observers
A single auction has a serial decision ceiling even when unrelated auctions scale out. If a measured decision occupies 5 ms of its authority, the ideal serial ceiling is about 200 decisions/s before overhead. At 500 attempts/s, a queue grows by roughly 300/s; a ten-second burst adds 3,000 attempts. A 500 ms queue budget supports at most about 100 queued decisions at 200/s under a simple constant-cost model, not an unlimited accepted backlog.
Reject overload before promising accepted bids, or use the explicit bounded ingress-log contract. Accepted receipts, current close head and private maxima have different retention requirements from disposable live-view cursors. A slow socket exceeding its finite replay/buffer horizon receives snapshot-required recovery with public fields only. Bid acceptance cannot wait for every subscriber.
A settlement outage accumulating 20 awards/s for five minutes creates 6,000 cases. Recovery at 50/s with 20/s new work drains at 30/s over at least 200 seconds. Track bid decision/queue age, close-generation conflicts, reserve eligibility, private-field exposure, overdue closure, settlement unknown age and final-result/award mismatches. Canary policy changes on a fixed bid corpus; rollback cannot reinterpret already accepted bids under a different tie/reserve policy.
Auction assessment: preserve eligibility and result identity
Question: Start is 100, reserve is 150 and the sole bidder's maximum is 140. May the platform award at the reserve floor?
Show answer and explanation
Answer: No. That exceeds the maximum and fails reserve eligibility. This variant closes without a reserve-qualified winner.
Question: A bid accepted before an extension retries after closure. Should it be rejected as late or extend the auction again?
Show answer and explanation
Answer: Neither. Resolve its scoped original receipt; new intent needs a new identity and current policy. Stale close generations remain fenced.
Question: Winner payment timed out. May the runner-up receive an immediate automatic award?
Show answer and explanation
Answer: No. Preserve the closed result and uncertain original payment. A separate second-chance policy requires definitive resolution and an audited award transition.
Score one point for explicit reserve/increment/tie eligibility, private-field and compatible maximum-state handling, scoped receipt/deadline/generation order, frozen result with separate recoverable award/payment, and finite hot-auction/live-view/recovery capacity. Compare Contention, Payments and Time and Ordering.
Can a bid be accepted solely because the client timestamp is before the displayed close time?
Your design draft
Clarify assumptions, explain your approach, and test the difficult cases. Save your draft, then compare it with the study notes.
Self-review checklist
Self-guided practice. Automated AI feedback and code execution are not connected.