KatInterview

Design a Kubernetes-Based Object Metadata Store with Cassandra

System DesignModel answer
HardModel answerSystem Designsystem-designcassandrakubernetes

Last updated

Design an API metadata service on Kubernetes and Cassandra featuring exact-once unique name constraints, soft-delete state transitions, and high-performance read strategies.

You are tasked with designing a stateless Java web application running on Kubernetes that interfaces with an Apache Cassandra cluster. The service acts as an artifact metadata management system where each artifact is identified by a unique, user-defined string key (the artifact name).

Your system design must explicitly address the following three dimensions:

  1. Concurrency & Uniqueness on Ingestion (Create):

    • Explain how you guarantee that an artifact name is created exactly once, even under extreme concurrent requests and client retries.
    • Detail the primary key schema, idempotency keys, write consistency levels, concurrency mechanisms (e.g., Lightweight Transactions / Paxos vs. external locking), error handling (e.g., CAS timeouts), and failure modes.
  2. Deletion & Lifecycle Management (Delete & Re-creation):

    • Formulate a strategy for handling deletions and potential re-creations of previously used artifact names.
    • Address anti-entropy challenges like Cassandra tombstones, data resurrection/zombies, tombstone compaction, generation tracking, and soft-delete state transitions.
  3. Read Optimization & Resiliency (Get & List):

    • Architect the read path to support low-latency metadata retrieval under high traffic volumes.
    • Describe your read consistency choices (LOCAL_QUORUM vs LOCAL_ONE), multi-layer caching, pagination over partition key distributions, mitigation of hot partitions, and fallback mechanisms during partial node or network outages.

Hints

Hint 1

Consider separating binary file storage (S3/GCS) from metadata storage (Cassandra) to avoid small-sstable performance bottlenecks.

Hint 2

Cassandra LWTs (Lightweight Transactions) use Paxos internally; understand how Paxos handles network timeouts on write acknowledged steps versus unacknowledged state transitions.

Hint 3

Using standard SQL/CQL hard DELETE statements in Cassandra writes tombstones, which can cause read performance degradation and data resurrection if gc_grace_seconds expires before repair runs.