Practice
Solution
Step 1: Understand visibility timeout semantics
Visibility timeout hides the message during processing; if not acknowledged, it reappears for redelivery.Step 2: Analyze options
Immediate deletion (A) risks data loss; archiving without retry (C) prevents recovery; dead-letter queue (D) is for failed retries, not timeout expiry.Final Answer:
Option D -> Option DQuick Check:
Visibility timeout expiry -> message reappears for retry [check]
Solution
Step 1: Identify the need for decoupling writes and fan-out
Relational DB triggers (A) cause synchronous blocking and don't scale to 1M writes/sec. Redis (C) is fast but lacks durability and ordering guarantees for fan-out. Polling (D) adds latency and load on clients.Step 2: Evaluate Kafka for asynchronous, durable, partitioned messaging
Kafka partitions by user ID to preserve ordering per user and decouples writes from fan-out delivery, handling high throughput efficiently.Final Answer:
Option C -> Option CQuick Check:
Kafka partitions enable scalable, ordered fan-out delivery [check]
Solution
Step 1: Compare OT and CRDT for offline and distributed scenarios
OT typically requires a central server to order and transform operations, making offline support complex.Step 2: Understand CRDT advantages
CRDTs are designed for decentralized environments, allowing local operations to be merged eventually without coordination, ideal for offline edits and global distribution.Final Answer:
Option C -> Option CQuick Check:
CRDTs enable offline edits and eventual consistency without central coordination [check]
Solution
Step 1: Understand backend behavior without rate limiting
Without rate limiting, traffic spikes overwhelm backend, causing resource exhaustion and crashes or unresponsiveness.Step 2: Eliminate incorrect failure modes
Automatic instant scaling (C) is unrealistic; graceful rejection (D) requires rate limiting; queuing all requests (A) leads to resource exhaustion and eventual failure.Final Answer:
Option A -> Option AQuick Check:
Spike without limiter -> backend crash or unresponsiveness [check]
Solution
Step 1: Analyze timestamp and network constraints
Timestamp synchronization (A) is challenging but tolerable with NTP; network coordination (D) is minimal as IDs are generated locally.Step 2: Evaluate sequence number limits
Sequence number (B) limits per millisecond can cause blocking but can be mitigated by load balancing or sharding.Step 3: Identify machine ID allocation bottleneck
Machine ID bits are fixed (e.g., 10 bits), limiting the number of unique machines. At 10x scale, running out of unique machine IDs causes collisions or requires complex reallocation.Final Answer:
Option D -> Option DQuick Check:
Fixed machine ID bits limit scale -> collisions or reconfiguration needed [check]
