Katkat

Design a replicated cloud storage service

MicrosoftSoftware Engineer · Technical Screen

Last updated

This problem tests your ability to design a distributed, highly available object storage system by addressing metadata management, data consistency, and replication strategies.

Problem Statement

Design a distributed cloud object storage service (similar to Amazon S3 or Azure Blob Storage). The system must support storing unstructured binary objects (blobs) of varying sizes, with high availability and durability.

Functional Requirements

  1. Put(bucket, key, data): Store a new object or overwrite an existing one.
  2. Get(bucket, key): Retrieve an object's contents.
  3. Delete(bucket, key): Remove an object from the system.

Non-Functional Requirements

  • Durability: Data should survive the permanent loss of at least two physical storage nodes.
  • Scalability: The system must handle petabytes of data and tens of thousands of requests per second.
  • Consistency: The system should provide strong consistency for metadata (listing/metadata updates) and eventual consistency for data updates.

Deliverables

  • API Definition: Define the necessary service interfaces.
  • Data Model: Explain how metadata (mapping key to physical location) and data are stored.
  • High-Level Architecture: Describe the components (e.g., Load Balancers, Metadata Service, Storage Nodes) and their interactions.
  • Replication Strategy: Explain how data is replicated and how consistency is maintained during failures.

Constraints

  • Assume storage nodes can be added or removed dynamically.
  • Metadata queries are frequent and latency-sensitive.
  • Objects can range from a few KB to several GB.

Hints

Hint 1

Consider separating the metadata (stored in a distributed database like Spanner or Cassandra) from the actual binary data (stored on flat files on disk).

Hint 2

Think about using consistent hashing or a global index service to map object IDs to physical storage nodes.

Hint 3

For durability, evaluate the trade-offs between synchronous replication (low latency/high consistency) and asynchronous replication (high performance/eventual consistency).

Follow-up questions

  • How would you handle the 'hot key' problem where a single popular object receives an massive spike in traffic?
  • What mechanisms would you implement to detect and repair data corruption or 'bit rot' on physical disks?
  • How would you optimize the system for cross-region replication to improve disaster recovery and global access latency?