Practice
Solution
Step 1: Identify the need for decoupling high write throughput
Immediate synchronous writes (Use a relational database with immediate synchronous writes for all connection requests and D) block user actions and don't scale well at 1M writes/sec. Redis (Use an in-memory cache like Redis to store connection requests temporarily without persistence) lacks durability and persistence guarantees for critical connection data.Step 2: Evaluate Kafka's role
Kafka buffers high write volume asynchronously, ensuring durability and eventual consistency without blocking user requests.Final Answer:
Option A -> Option AQuick Check:
Kafka buffers writes asynchronously -> decouples load [check]
Solution
Step 1: Understand rename operation atomicity
Rename involves updating metadata entries; if crash occurs mid-update, partial state may persist.Step 2: Trace failure effect
Partial metadata update can cause both old and new filenames to appear, confusing clients.Final Answer:
Option D -> Option DQuick Check:
Partial metadata updates cause duplicate filenames visible to client [check]
Solution
Step 1: Analyze team size and feature velocity constraints
Small teams benefit from simpler architectures to reduce overhead and speed delivery.Step 2: Evaluate operational complexity of microservices
Microservices add deployment and operational complexity, which can slow small teams.Final Answer:
Option B -> Option BQuick Check:
Monolith reduces complexity, speeds delivery for small teams [check]
Solution
Step 1: Analyze Delivery Worker scalability
Delivery Workers are CPU and thread-bound; increasing scale requires more workers, but thread limits and resource contention cause bottlenecks.Step 2: Compare other components
Relational DB (A) can be sharded; push gateways (C) are rate-limited but can be scaled with multiple credentials; presence cache (D) can be sharded with consistent hashing.Final Answer:
Option A -> Option AQuick Check:
Delivery Workers hit thread and CPU limits first at 10x scale [check]
Solution
Step 1: Analyze stateful components and scaling challenges
Databases (The database, because increased writes cause lock contention) can be scaled with sharding and replicas. Message queue brokers (The message queue brokers, due to partition leader overload) scale horizontally with partitions. Delivery workers (The delivery workers, because retry queues grow exponentially) can be scaled with backpressure.Step 2: Identify chat servers as stateful WebSocket connection holders
Chat servers maintain persistent WebSocket connections bound to server memory, making resharding or migration difficult at scale.Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket servers -> first bottleneck at 10x scale [check]
