Problem Description
Design a distributed backend system for storing and querying application metrics. The system must collect time-series metrics from numerous services operating across multiple machines and regions.
Each metric sample will contain:
- A metric name
- Labels or tags (e.g., service, host, region, environment)
- A timestamp
- A numeric value
Core Requirements
The system must satisfy the following:
- High Write Throughput: Support continuous, high-volume ingestion of metrics.
- Metric Types: Accommodate counters, gauges, and histogram-like metrics.
- Query Capabilities: Allow users to query data by metric name, label filters, and time range.
- Low Latency for Recent Data: Power dashboards and alerting systems with fast access to recent data.
- Tiered Storage: Optimize for fast queries of recent data while cost-effectively retaining historical data.
- Scalability: Scale horizontally to handle a growing number of services and metric series.
- Fault Tolerance: Tolerate machine and zone failures without data loss or significant downtime.
- Data Management: Implement retention policies, data compaction, and downsampling mechanisms.
Optional Requirements
- Multi-tenancy: Support isolation for multiple tenants.
- Rate Limiting: Implement rate limits for metric ingestion.
Design Deliverables
Candidates should describe the following aspects of their design:
- API definition
- Storage model
- Sharding strategy
- Ingestion path
- Query path
- Failure handling mechanisms
- Major trade-offs considered
AI interview prep
Core dilemma
Balancing extremely high write throughput and low-latency query requirements for recent data with the need for cost-effective, long-term storage and complex analytical queries over historical data, all while maintaining horizontal scalability and fault tolerance.
3 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Problem Description
Design a distributed backend system for storing and querying application metrics. The system must collect time-series metrics from numerous services operating across multiple machines and regions.
Each metric sample will contain:
- A metric name
- Labels or tags (e.g., service, host, region, environment)
- A timestamp
- A numeric value
Core Requirements
The system must satisfy the following:
- High Write Throughput: Support continuous, high-volume ingestion of metrics.
- Metric Types: Accommodate counters, gauges, and histogram-like metrics.
- Query Capabilities: Allow users to query data by metric name, label filters, and time range.
- Low Latency for Recent Data: Power dashboards and alerting systems with fast access to recent data.
- Tiered Storage: Optimize for fast queries of recent data while cost-effectively retaining historical data.
- Scalability: Scale horizontally to handle a growing number of services and metric series.
- Fault Tolerance: Tolerate machine and zone failures without data loss or significant downtime.
- Data Management: Implement retention policies, data compaction, and downsampling mechanisms.
Optional Requirements
- Multi-tenancy: Support isolation for multiple tenants.
- Rate Limiting: Implement rate limits for metric ingestion.
Design Deliverables
Candidates should describe the following aspects of their design:
- API definition
- Storage model
- Sharding strategy
- Ingestion path
- Query path
- Failure handling mechanisms
- Major trade-offs considered