Practice
1. In a primary-replica replication system, at step 4 the replica receives a batch of write-ahead log entries from the primary. What is the replica's exact state after applying these entries?
easy
Solution
Step 1: Trace replica behavior at step 4
Replica applies WAL entries to its local store to catch up with primary.Step 2: Understand acknowledgment timing
Replica acknowledges primary only after applying entries to ensure durability and consistency.Final Answer:
Option B -> Option BQuick Check:
Replica applies then acknowledges -> ensures data durability [check]
Hint: Apply WAL entries before ack -> durability ensured [check]
Common Mistakes:
2. In the web crawler's request flow, at Step 5 the Duplicate Detection component receives a URL. What happens if this URL has been seen before?
easy
Solution
Step 1: Understand Duplicate Detection behavior at Step 5
If the URL has been seen before, it is filtered out to prevent redundant crawling.Step 2: Eliminate other options
Re-queuing duplicates wastes resources; marking for delayed re-crawl is a separate process; Politeness Policy Manager handles timing, not duplication.Final Answer:
Option A -> Option AQuick Check:
Duplicate Detection discards seen URLs to avoid redundancy [check]
Hint: Duplicate Detection discards duplicates before scheduling [OK]
Common Mistakes:
3. A messaging system must handle 1 million writes per second and guarantee message durability despite server crashes. Which component best ensures durability without blocking producers?
easy
Solution
Step 1: Identify durability and high write throughput needs
In-memory queues with snapshots (A) risk data loss on crash; Redis without persistence (C) loses data on restart; synchronous DB writes (D) block producers and limit throughput.Step 2: Evaluate Kafka's distributed log
Kafka partitions topics for parallelism and persists data durably on disk, allowing high throughput and crash recovery without blocking producers.Final Answer:
Option B -> Option BQuick Check:
Kafka partitions + durable log -> high throughput + durability [check]
Hint: Durable logs handle high writes without blocking producers [OK]
Common Mistakes:
4. A messaging system must decouple high-throughput message producers from multiple independent consumers subscribing to different topics. Which component best handles this decoupling and ensures message durability?
easy
Solution
Step 1: Identify decoupling and durability needs
In-memory queues (Use a simple in-memory queue on the producer server to buffer messages) lack durability and don't scale across servers. Direct HTTP push (Use a direct HTTP push from producer to each consumer) tightly couples producer and consumers, causing backpressure issues. Polling a relational DB (Use a relational database with polling by consumers) adds latency and load on DB, unsuitable for high throughput.Step 2: Recognize Kafka's role
Kafka's distributed log with topic partitions decouples producers and consumers, provides durability, and supports high throughput with consumer groups.Final Answer:
Option A -> Option AQuick Check:
Kafka partitions enable durable, scalable decoupling [check]
Hint: Distributed logs decouple producers and consumers reliably [OK]
Common Mistakes:
5. For real-time message delivery to mobile clients with intermittent connectivity, which architecture best balances latency and resource usage?
medium
Solution
Step 1: Evaluate WebSocket vs gRPC streaming for mobile clients
gRPC streaming is efficient but poorly supported on many mobile platforms; WebSocket is widely supported with heartbeat to detect disconnects.Step 2: Consider fallback mechanisms
WebSocket with push notification fallback handles intermittent connectivity better than long polling or MQTT, which have higher overhead or complexity.Final Answer:
Option B -> Option BQuick Check:
WebSocket + push fallback balances latency and mobile constraints [check]
Hint: WebSocket + push fallback handles mobile connectivity best [check]
Common Mistakes:
