Practice
Solution
Step 1: Identify rate limiting responsibility
The API Gateway is the entry point and can efficiently enforce rate limits before requests reach backend services, preventing overload.Step 2: Eliminate other options
The backend microservices implement rate limiting individually to distribute load spreads rate limiting, risking inconsistent enforcement and backend overload. A centralized database tracks request counts and enforces limits synchronously adds latency and complexity by synchronous DB checks. Clients are responsible for self-throttling their request rates trusts clients, which is insecure.Final Answer:
Option A -> Option AQuick Check:
API Gateway enforces rate limits upfront to protect backend [check]
Solution
Step 1: Understand Zookeeper ephemeral node disappearance
Leader's ephemeral node disappearance signals leader failure.Step 2: Follower reaction
Follower tries to create ephemeral node to become new leader; immediate assumption without coordination risks split-brain.Final Answer:
Option A -> Option AQuick Check:
Follower creates ephemeral node -> attempts leadership [check]
Solution
Step 1: Analyze branching strategies for scale
Lightweight branch pointers referencing immutable commits allow fast branch creation and merges without locking, supporting high concurrency.Step 2: Evaluate other options
Centralized locking serializes operations, hurting performance; full branch copies waste storage and complicate merges; synchronous replication adds latency and reduces availability.Final Answer:
Option B -> Option BQuick Check:
Immutable commits + lightweight pointers -> scalable branching [check]
Solution
Step 1: Evaluate modulo hashing with fixed partitions
Modulo hashing causes large remapping on node changes, poor for frequent changes.Step 2: Compare consistent hashing with virtual nodes
Virtual nodes spread load evenly and reduce remapping, ideal for frequent node changes.Final Answer:
Option D -> Option DQuick Check:
Virtual nodes in consistent hashing balance load and minimize remapping [check]
Solution
Step 1: Analyze query and write patterns
Queries filter by device and time ranges; writes are high volume per device.Step 2: Evaluate partitioning strategies
Partitioning by device ID localizes writes and queries; clustering by timestamp supports efficient range scans. Single partition key causes hotspots; partitioning by timestamp scatters device data, hurting queries; relational DBs can't handle high write scale.Final Answer:
Option B -> Option BQuick Check:
Partition by device ID + cluster by timestamp -> balanced writes and efficient queries [check]
