Practice
Solution
Step 1: Identify cache update timing
Write-Through updates cache and database synchronously, ensuring cache is always fresh.Step 2: Eliminate other patterns
Cache Aside updates cache only on misses, risking stale cache after writes; Read-Through only loads on reads; Write-Behind delays DB update, risking stale cache.Final Answer:
Option B -> Option BQuick Check:
Write-Through synchronously updates cache and DB [check]
Solution
Step 1: Understand Transcoding Worker queue interaction
Transcoding Workers typically use message brokers with blocking or long-polling to avoid busy-waiting. Immediate shutdown (A) wastes throughput. Polling with delay (B) causes unnecessary load and latency. Backup queue in DB (D) is inefficient and not standard.Step 2: Recognize blocking on broker notification
Blocking on a message broker notification (e.g., Kafka consumer poll or RabbitMQ consumer wait) is efficient and standard to wait for new tasks.Final Answer:
Option D -> Option DQuick Check:
Blocking on broker notification avoids busy polling [check]
Solution
Step 1: Understand distributed lock requirements
Single Redis instance with SETNX risks single point of failure and split-brain issues.Step 2: Evaluate Redlock's multi-instance coordination
Redlock uses multiple Redis masters to reduce risk of deadlocks and ensure safety under partial failures.Final Answer:
Option A -> Option AQuick Check:
Redlock coordinates multiple Redis masters for safer distributed locks [check]
Solution
Step 1: Analyze write scalability and read patterns
High write throughput and millions of users require scalable writes and efficient feed reads.Step 2: Evaluate referencing with denormalization
Referencing separates concerns; denormalizing popular posts into feeds optimizes read performance without large documents.Final Answer:
Option D -> Option DQuick Check:
Referencing plus denormalization balances write scale and read speed [check]
Solution
Step 1: Identify scaling impact on cache
At 10x scale, cache memory pressure increases due to more data and entries.Step 2: Evaluate failure likelihood
Cache memory exhaustion is common before DB or network fail due to caching.Final Answer:
Option C -> Option CQuick Check:
Cache memory limits cause failure first at scale [check]
