Design a Book Price Aggregator
Company: Databricks
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
Design a book purchasing marketplace where your service acts as an intermediary between customers and hundreds of partner bookstores.
A customer submits:
- An ISBN
- A bid price, which is the maximum price they are willing to pay
- A payment method
Your system must fan out asynchronous requests to hundreds of partner bookstores to find available inventory and prices.
Behavior:
1. If at least one bookstore has inventory and the lowest available price is less than or equal to the customer's bid price, place an order with that bookstore.
2. If bookstores have inventory but the lowest available price is higher than the bid price, return the lowest price to the customer.
3. If no bookstore has inventory, notify the customer that the book is unavailable.
Discuss the design in depth, especially:
- How to tolerate downstream bookstore failures, slow responses, and timeouts.
- How to aggregate partial results when not all bookstores respond.
- Whether and how to use circuit breakers.
- How to scale the system when external call volume is large.
- How to reduce downstream calls using caching, TTLs, request coalescing, and thundering-herd protection.
- How to handle consistency when ordering and charging are two separate external calls.
- Whether to order first or charge first, how to recover if the system crashes midway, and how to prevent duplicate charges or duplicate orders.
Quick Answer: This question evaluates skills in distributed systems design, fault tolerance, scalability, integration with external services, transactional consistency across asynchronous operations, and reliability patterns such as caching, request coalescing, and failure isolation.