Practice
Solution
Step 1: Identify the role of the decoupling component
The component must provide durability and handle high throughput without blocking the ingestion path.Step 2: Evaluate Kafka's suitability
Kafka provides a distributed, durable log with partitioning and replication, enabling asynchronous processing and replay.Final Answer:
Option A -> Option AQuick Check:
Kafka decouples ingestion and processing with durability and scale [check]
Solution
Step 1: Identify the need for a consistent global count
Local counters aggregated periodically (Use a local in-memory counter on each API server and aggregate periodically) cause stale counts and race conditions, failing real-time enforcement.Step 2: Evaluate Redis atomic increments
Redis supports atomic INCR commands ensuring consistent, real-time global counters across distributed servers.Final Answer:
Option D -> Option DQuick Check:
Redis atomic counters ensure global consistency and low latency [check]
Solution
Step 1: Trace failure impact of Kafka unavailability
Kafka unavailability blocks producers or causes retries; delivery workers cannot fetch messages from Kafka.Step 2: Evaluate fallback mechanisms
In a robust design, a backup queue or dead-letter queue is used to avoid message loss; synchronous HTTP fallback (D) is not automatic; silent loss (A) is unacceptable.Final Answer:
Option C -> Option CQuick Check:
Backup queue prevents message loss during Kafka downtime [check]
Solution
Step 1: Understand Kafka's role in ingestion
Kafka decouples ingestion; if unavailable, producers (WebSocket Server) cannot push messages.Step 2: Trace failure impact
WebSocket Server buffers updates temporarily but memory is limited; blocking would cause backpressure but usually async buffers exist.Final Answer:
Option A -> Option AQuick Check:
Kafka outage causes buffering, not silent loss or blocking immediately [check]
Solution
Step 1: Analyze vector search scaling
Vector search scales with index size but can shard horizontally; query latency grows but not immediate failure (A incorrect).Step 2: Assess code generator scaling
GPU saturation is a bottleneck but can be mitigated by batching and autoscaling (B less immediate).Step 3: Evaluate API gateway
API gateways are stateless and horizontally scalable (C incorrect).Step 4: Identify WebSocket server bottleneck
WebSocket servers hold stateful connections bound to server memory; sharding existing connections is complex, causing first failure at 10x scale (D correct).Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket connections limit server scaling [check]
