Practice
1. In the Reddit voting system request flow, at step 4 the Vote Processor reads from the Kafka topic partition keyed by post_id. What state does the Vote Processor maintain after processing a vote event at this step?
easy
Solution
Step 1: Understand Vote Processor's role at step 4
The Vote Processor consumes vote events from Kafka, updates the post's score in an in-memory cache, and commits the offset to mark progress.Step 2: Eliminate incorrect states
It marks the vote as delivered but does not update the post's score yet is incorrect because score update happens here. It deletes the vote event from Kafka to prevent reprocessing is invalid as Kafka is immutable; events are not deleted. It sends an immediate notification to all subscribers before updating the score is wrong because notifications happen after score update, not before.Final Answer:
Option A -> Option AQuick Check:
Vote Processor updates score cache and commits Kafka offset [check]
Hint: Vote Processor updates score cache and commits offset [check]
Common Mistakes:
2. A microservices architecture requires low-latency, strongly typed RPC calls between internal services with automatic code generation. Which technology best fits this requirement?
easy
Solution
Step 1: Identify serialization and transport needs
Low-latency and strongly typed RPC require efficient binary serialization and HTTP/2 transport.Step 2: Evaluate technology fit
gRPC uses Protocol Buffers for compact binary serialization and HTTP/2 for multiplexed streams, meeting requirements. REST with JSON is flexible but slower and less type-safe. GraphQL is query-focused, not RPC. SOAP is verbose and outdated.Final Answer:
Option D -> Option DQuick Check:
gRPC + Protobuf -> low-latency, strongly typed RPC [check]
Hint: Binary + HTTP/2 + codegen = gRPC [check]
Common Mistakes:
3. A real-time analytics system must ingest 1 million events per second and provide near-instant query results. Which component best handles the ingestion to balance latency and throughput?
easy
Solution
Step 1: Identify ingestion requirements
High throughput and low latency ingestion require a scalable, partitioned system that can handle parallel writes.Step 2: Evaluate components
Relational DBs (A) can't handle this write volume with low latency; single-threaded queues (C) limit throughput; batch systems (D) increase latency.Final Answer:
Option C -> Option CQuick Check:
Kafka partitions enable parallel ingestion with low latency [check]
Hint: Partitioned logs scale writes and keep latency low [check]
Common Mistakes:
4. For a mobile app requiring real-time notifications at 10x scale, which architecture is better and why?
medium
Solution
Step 1: Evaluate mobile client support
gRPC streaming (Use gRPC streaming for persistent connections to push notifications) is efficient but poorly supported on many mobile platforms, causing compatibility issues.Step 2: WebSockets with connection broker
WebSockets (Use WebSockets with a scalable connection broker to handle mobile client limitations) are widely supported on mobile and, with a scalable broker, can handle millions of connections efficiently.Step 3: Polling drawbacks
Long polling (Use long polling HTTP requests to simulate real-time updates) and periodic polling (Use periodic polling every 5 seconds to reduce server load) increase latency and server load, unsuitable for real-time at scale.Final Answer:
Option A -> Option AQuick Check:
WebSockets + broker -> scalable, mobile-friendly real-time [check]
Hint: WebSockets scale better on mobile than gRPC streaming [OK]
Common Mistakes:
5. At 10x scale in user requests and live traffic updates, which component is most likely to fail first and why?
hard
Solution
Step 1: Analyze scaling bottlenecks
Road Graph DB (A) can be sharded; ingestion pipeline (C) can scale horizontally; client rendering (D) is local and less critical.Step 2: Identify Routing Engine CPU bottleneck
Routing Engine performs complex shortest path computations per request; 10x load causes CPU saturation and latency spikes, failing first.Final Answer:
Option C -> Option CQuick Check:
Routing Engine CPU-bound under 10x load causes first failure [check]
Hint: Routing Engine CPU saturates first under 10x load [check]
Common Mistakes:
