Problem Description
Design a platform capable of storing historical stock prices over time and serving queries for these prices.
Core Functionalities
- Ingest Price: The system must receive and store price events, each containing:
ticker(string, e.g.,AAPL)price(decimal)timestamp(event time)
- Query Price: Given a
tickerand atimestamp, the system must return the corresponding price.
Clarifications and Assumptions
Candidates are expected to address and state assumptions for the following aspects in their design:
- Query Behavior for Non-Exact Timestamps: If no price exists exactly at the queried timestamp, should the system return:
- The most recent price at or before the timestamp (common industry practice)?
- "Not found" unless an exact match exists?
- Expected Scale: Define assumptions for:
- Number of unique tickers.
- Events per second (ingestion rate).
- Data retention period (e.g., 1 day vs. 10 years).
- Latency Targets: Specify assumed latency requirements for both read and write operations.
- Event Handling: How will the system handle:
- Out-of-order events?
- Duplicate events?
- Clock skew issues?
Deliverables
The design should cover:
- High-level architecture, detailing both the write path and the read path.
- Data model and the chosen storage technology.
- Definition of APIs for ingestion and querying.
- Strategy for partitioning and indexing data.
- Discussion of consistency, availability, and failure-handling tradeoffs.
AI interview prep
Core dilemma
Balancing extreme write throughput and potential out-of-order data ingestion with low-latency, time-series-specific queries (e.g., 'at or before' semantics) across a vast, continuously growing dataset.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Problem Description
Design a platform capable of storing historical stock prices over time and serving queries for these prices.
Core Functionalities
- Ingest Price: The system must receive and store price events, each containing:
ticker(string, e.g.,AAPL)price(decimal)timestamp(event time)
- Query Price: Given a
tickerand atimestamp, the system must return the corresponding price.
Clarifications and Assumptions
Candidates are expected to address and state assumptions for the following aspects in their design:
- Query Behavior for Non-Exact Timestamps: If no price exists exactly at the queried timestamp, should the system return:
- The most recent price at or before the timestamp (common industry practice)?
- "Not found" unless an exact match exists?
- Expected Scale: Define assumptions for:
- Number of unique tickers.
- Events per second (ingestion rate).
- Data retention period (e.g., 1 day vs. 10 years).
- Latency Targets: Specify assumed latency requirements for both read and write operations.
- Event Handling: How will the system handle:
- Out-of-order events?
- Duplicate events?
- Clock skew issues?
Deliverables
The design should cover:
- High-level architecture, detailing both the write path and the read path.
- Data model and the chosen storage technology.
- Definition of APIs for ingestion and querying.
- Strategy for partitioning and indexing data.
- Discussion of consistency, availability, and failure-handling tradeoffs.