Katkat

Design globally consistent metadata service

AmazonSoftware Engineer · Onsite

Last updated

This question tests the ability to design a globally distributed metadata service that requires strict consistency for frequent read/write operations across multiple geographic regions.

Problem Statement

Design a global metadata service that stores key-value pairs (e.g., file paths to storage locations, user configuration flags). The system must support high availability across at least three global regions (e.g., US-East, EU-West, Asia-Pacific).

Functional Requirements

  • put(key, value): Updates or creates a value. Must be linearizable.
  • get(key): Returns the current value. Must be linearizable.
  • Support for list(prefix): Efficient retrieval of metadata keys under a certain path.

Non-Functional Requirements

  • Consistency: Strict consistency (linearizability) is required; clients must never see stale data.
  • Latency: Optimize for low-latency reads. Writes are acceptable at higher latencies given cross-region communication.
  • Scalability: Must handle 100,000 requests per second globally.
  • Durability: Data must survive the total loss of a single region.

Deliverables

  1. High-level architecture diagram and component interaction flow.
  2. Choice of data store and replication strategy (e.g., Paxos/Raft groups, synchronous/asynchronous replication).
  3. Strategy for handling cross-region network partitions.
  4. API design for the read/write paths.

Hints

Hint 1

Consider how a distributed consensus algorithm (like Raft or Paxos) can be used to achieve linearizability across nodes.

Hint 2

Think about the trade-off between local-read latency and the requirement for global consistency.

Hint 3

How would you handle the storage and indexing of metadata to support efficient prefix-based queries while maintaining consistency?

Follow-up questions

  • How would you implement a 'read-only' replica in a new geographic region without adding significant latency to the leader?
  • If the metadata service becomes a bottleneck, how would you partition (shard) the keyspace across multiple consensus groups?
  • Describe the process of a controlled migration or rollback if a faulty update is propagated to all regions.