Practice
Solution
Step 1: Identify the need for durability and ordering
Relational DB synchronous writes (Use a relational database with immediate synchronous writes for each vote) cause high latency and don't scale to 1M writes/sec. Redis without persistence (Use an in-memory cache like Redis without persistence to handle votes) risks data loss on failure. Batch processing (Use a batch processing system that aggregates votes every hour) introduces unacceptable latency.Step 2: Recognize Kafka's role
Kafka provides durable, ordered, high-throughput buffering of vote events, decoupling ingestion from processing.Final Answer:
Option D -> Option DQuick Check:
Kafka buffers high-write streams with durability and ordering [check]
Solution
Step 1: Analyze A/B testing constraints
Minimal latency impact and controlled traffic routing are key.Step 2: Evaluate architectures
Duplicating traffic synchronously (A) doubles latency; DNS switching (C) is slow and coarse-grained; embedding model logic in Feature Store (D) mixes concerns and complicates feature retrieval. Feature flag routing (B) allows asynchronous, fine-grained control with minimal latency impact.Final Answer:
Option A -> Option AQuick Check:
Feature flag routing -> low latency, flexible A/B testing [check]
Solution
Step 1: Evaluate TLS versions and key exchange
TLS 1.3 supports ephemeral key exchange (ECDHE) which provides forward secrecy and reduces handshake round trips, lowering latency.Step 2: Eliminate other options
Use TLS 1.0 with RSA key exchange for compatibility uses outdated TLS 1.0 and RSA key exchange lacking forward secrecy and higher latency. Disable certificate validation to speed up connections compromises security by disabling validation. Use self-signed certificates to avoid certificate chain overhead risks trust issues and is unsuitable for public APIs.Final Answer:
Option A -> Option AQuick Check:
TLS 1.3 ephemeral keys -> forward secrecy + lower latency [check]
Solution
Step 1: Analyze game requirements
Real-time position updates require low latency but some reliability to avoid inconsistent state.Step 2: Evaluate protocol trade-offs
UDP provides low latency; adding application-level sequence numbers and selective retransmission balances speed and reliability.Final Answer:
Option C -> Option CQuick Check:
UDP + app-level reliability fits real-time game updates [check]
Solution
Step 1: Identify stateful components in WebSocket architecture
WebSocket connections are stateful and maintained in server memory, binding clients to specific chat servers.Step 2: Analyze scaling challenges
At 10x scale, chat servers face difficulty resharding connections or migrating them, limiting horizontal scaling. Databases and load balancers can be scaled more easily. Client browser limits are less impactful at system scale.Final Answer:
Option A -> Option AQuick Check:
WebSocket stateful connections -> chat servers bottleneck at scale [check]
