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: Identify the protection mechanism against traffic bursts
Distributed cache (A) improves response time but doesn't limit request rate; load balancer (C) distributes load but can't prevent overload from bursts; message queue (D) buffers but can be overwhelmed if bursts are too large.Step 2: Recognize rate limiter role
Rate limiter (B) enforces quotas per client, directly preventing backend overload by rejecting or delaying excess requests.Final Answer:
Option B -> Option BQuick Check:
Rate limiter enforces quotas to prevent overload [check]
Solution
Step 1: Evaluate client-specific optimization needs
Separate BFF layers per client type allow tailored APIs, improving UX and reducing client complexity.Step 2: Assess maintainability
Separate BFF layers per client type behind a common API Gateway isolates client-specific logic in BFFs, keeping microservices generic and maintainable. Single API Gateway forwarding requests directly to microservices with client logic inside services mixes client logic into services, increasing coupling. One monolithic backend serving all clients with feature flags for client differences's monolith reduces flexibility and scalability. Client apps call microservices directly, bypassing API Gateway and BFF breaks encapsulation and complicates security.Final Answer:
Option B -> Option BQuick Check:
Separate BFFs isolate client logic, improving maintainability and optimization [check]
Solution
Step 1: Analyze retry strategies for latency and reliability
Scheduled retries with delayed queues (B) balance retry timing and system load, reducing hot loops.Step 2: Evaluate other options
Immediate retries (A) risk overload; manual retries (C) add latency; infinite retries (D) cause resource exhaustion.Final Answer:
Option C -> Option CQuick Check:
Delayed queue retries balance latency and failure handling [check]
Solution
Step 1: Understand Kafka unavailability impact
Without Kafka, ingestion of new document updates cannot proceed, causing blocking or stalling.Step 2: Evaluate options
Indexing workers do not have local caches of events (A) and cannot continue processing. Automatic failover to a backup queue with identical ordering (C) is a designed mitigation. Index corruption (D) does not happen immediately; missing events cause stale results but not corruption.Final Answer:
Option A -> Option AQuick Check:
Failover to backup queue prevents pipeline stall [check]
