Practice
Solution
Step 1: Identify Kafka's role in ordering and durability
Kafka partitions keyed by stock symbol ensure strict ordering per symbol and durable storage of orders before matching.Step 2: Eliminate other options
Redis lacks durability guarantees; relational DB with global sequence is a bottleneck at scale; RabbitMQ without partitioning cannot guarantee ordering per symbol.Final Answer:
Option A -> Option AQuick Check:
Kafka partition keyed by symbol -> ordering + durability guaranteed [check]
Solution
Step 1: Identify edge enforcement needs
Enforcement must be low-latency and close to the client to avoid network round trips.Step 2: Evaluate options for latency and consistency
Centralized DB (A) adds latency; batch jobs (C) are too delayed; client SDK (D) is untrustworthy. Edge cache with local counters (B) balances latency and eventual consistency.Final Answer:
Option B -> Option BQuick Check:
Edge cache enforces limits locally with periodic sync [check]
Solution
Step 1: Trace Delivery Worker decision at Step 4 -- Bob's presence TTL
If TTL expired, recipient is offline; message can't be delivered immediately.Step 2: Understand offline delivery handling
Delivery Worker queues message for later delivery and marks status as 'sent but not delivered' to reflect state.Final Answer:
Option A -> Option AQuick Check:
Expired TTL -> queue message, status 'sent but not delivered' [check]
Solution
Step 1: Trace Request Handler token check at Step 4
If the token bucket is empty, no tokens are available to allow immediate processing.Step 2: Determine request fate
The request must be rejected or delayed until tokens refill; processing without tokens violates rate limits.Final Answer:
Option C -> Option CQuick Check:
Empty bucket -> reject or delay request [check]
Solution
Step 1: Analyze event store scaling constraints
Kafka partitions limit throughput; increasing partitions requires rebalancing, causing temporary unavailability.Step 2: Compare other components
Read model DB can be scaled horizontally; command handler is async; Delivery Worker scales with consumers.Final Answer:
Option A -> Option AQuick Check:
Kafka partition limits and rebalancing -> first bottleneck at 10x scale [check]
