System Design: Multi-Tenant Interactive Analytics Platform
Context
Design a distributed, multi-tenant analytics service that lets customers:
-
Ingest batch files (e.g., CSV/JSON/Parquet) into cloud object storage.
-
Query this data using SQL with interactive latencies.
-
Scale compute elastically and isolate tenants.
Assume data is stored in immutable columnar files in cloud object storage (e.g., S3/GCS/Blob). The system manages metadata, query planning/execution, and resource isolation.
Requirements
Clearly address the following. Make reasonable assumptions and state them.
-
Assumptions and Scope
-
Define the product scope, non-goals, multi-tenancy, and deployment environment.
-
SLAs and Workloads
-
Quantify expected workloads (ingest rates, data size, query mixes, concurrency).
-
Define explicit SLOs/SLAs (latency, availability, durability).
-
APIs and Data Model
-
External APIs (ingest, schema, query submission, status, results) and auth.
-
Internal services and RPC contracts.
-
Data layout (partitions, file formats, statistics, indexes).
-
Sharding and Replication
-
Partitioning strategy for data, compute, and metadata.
-
Replication across AZ/regions; read/write routing.
-
Consistency Model and Trade-offs
-
Choose a consistency model for metadata and data.
-
Discuss CAP and latency vs. throughput trade-offs; snapshot isolation vs. read-after-write.
-
Failure Handling
-
Network partitions, node crashes, slow nodes.
-
Leader election, retries, idempotency, backpressure, speculative execution.
-
Observability
-
Metrics, logs, tracing; SLOs and error budgets; dashboards and alerts.
-
Capacity Planning
-
Estimate capacity; autoscaling; multi-tenant isolation and quota management; cost efficiency.
-
Testing, Deployment, Rollback
-
Strategy for unit/integration/load/chaos tests.
-
Staged rollouts, canaries, blue/green; safe rollback.
-
High-Level Architecture and Communication Patterns
-
Components, data/control planes, and interactions (client → coordinator → workers → storage).
Validate your assumptions and justify design choices.