Practice
Solution
Step 1: Understand shard assignment requirements
Modulo hashing (Use a modulo-based hash function on the primary key to assign shards directly) causes massive remapping when shards change; centralized lookup (Assign shards based on a centralized lookup table updated on every shard change) creates a bottleneck and single point of failure; range partitioning (Use range-based partitioning with fixed key ranges per shard) can cause hotspots and uneven load.Step 2: Evaluate consistent hashing benefits
Consistent hashing with virtual nodes (Implement consistent hashing with virtual nodes to map keys to shards) evenly distributes keys and minimizes remapping when shards are added or removed, making it ideal for dynamic shard management.Final Answer:
Option B -> Option BQuick Check:
Consistent hashing minimizes shard remapping on topology changes [check]
Solution
Step 1: Understand composite index column order
Composite indexes are ordered by the first column (A), then second (B). Queries filtering only on B cannot efficiently seek the index without filtering on A.Step 2: Analyze index usage at step 3
Since column A is not filtered, the engine must scan the entire index or large portions, resulting in a full index scan rather than an efficient seek.Final Answer:
Option A -> Option AQuick Check:
Composite index requires leading column filter for efficient seeks [check]
Solution
Step 1: Identify zero downtime requirement
Blue-Green deployment uses two identical environments and switches traffic instantly, ensuring zero downtime.Step 2: Eliminate other options
Canary is gradual, not instant; Feature flags don't switch entire environments; Rolling updates cause partial downtime.Final Answer:
Option D -> Option DQuick Check:
Blue-Green switches environments instantly for zero downtime [check]
Solution
Step 1: Understand role of Kafka in message durability and ordering
Without Kafka, no durable queue exists to buffer messages. Synchronous sends block (Alice's send blocks until Bob's server responds; if Bob's server crashes, message is lost with no retry) but blocking alone is not the only failure. Instant delivery out of order (Alice's message is delivered instantly but out of order) is unlikely without queue. Bob receiving but not acknowledging (Bob receives the message but cannot acknowledge receipt) is unrelated.Step 2: Identify duplication risk without queue deduplication and ordering guarantees
Without Kafka, retries and network issues cause message duplication due to lack of idempotent storage.Final Answer:
Option A -> Option AQuick Check:
No queue -> duplicates due to no deduplication [check]
Solution
Step 1: Understand distributed consensus role
Consensus protocols ensure coordinated writes and consistency across nodes.Step 2: Trace failure without consensus during partition
Without consensus, the cluster cannot safely coordinate writes and may fallback to a safe mode or external system.Final Answer:
Option D -> Option DQuick Check:
No consensus -> fallback to relational DB (plausible in some designs) [check]
