Practice
1. For the AI Code Assistant's latency budget of 100ms per request, which architecture best balances freshness of code context and response time?
medium
Solution
Step 1: Evaluate synchronous repository calls
Use a synchronous call to the code repository for every request to get the latest code causes high latency due to network and disk IO, violating 100ms budget.Step 2: Compare batch offline indexing
Use a batch offline indexing updated once a day and serve completions from cached embeddings sacrifices freshness, unsuitable for frequently changing codebases.Step 3: Assess purely generative model
Use a purely generative model without retrieval to avoid retrieval latency lacks grounding in latest code, reducing accuracy.Step 4: Identify hybrid RAG architecture
Use a hybrid RAG architecture with pre-indexed code embeddings updated periodically and a fast vector search balances freshness (periodic updates) and latency (fast vector search), meeting constraints.Final Answer:
Option D -> Option DQuick Check:
Hybrid RAG balances freshness and latency [check]
Hint: Hybrid RAG updates embeddings periodically for freshness and speed [check]
Common Mistakes:
2. For real-time query processing with low latency, which architecture is better suited for serving search results, and why?
medium
Solution
Step 1: Compare batch vs incremental indexing
Batch indexing has high latency, unsuitable for real-time queries. Incremental indexing supports near real-time updates.Step 2: Evaluate storage/query approaches
Querying raw pages or centralized DBs is too slow and unscalable for low latency search serving.Final Answer:
Option C -> Option CQuick Check:
Incremental indexing enables low-latency query serving [check]
Hint: Incremental indexing enables near real-time search [check]
Common Mistakes:
3. You need to model a social media feed with millions of users and high write throughput. Which data modeling approach is best to optimize for write scalability and read performance?
medium
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]
Hint: Reference plus denormalize popular data for scalable writes and fast reads [check]
Common Mistakes:
4. Without the DAU Estimator component, what exactly breaks in the system's capacity planning process?
medium
Solution
Step 1: Identify DAU Estimator role
DAU Estimator provides daily active user count critical for bandwidth calculations as bandwidth depends on total active users.Step 2: Eliminate other options
The system cannot estimate peak QPS, causing under-provisioning of servers is incorrect because peak QPS depends on instantaneous requests, not just DAU; Storage estimation becomes inaccurate because DAU is a key multiplier for daily data volume is partially true but storage depends more on total objects, not DAU alone; User authentication fails because DAU tracks active sessions is unrelated to authentication.Final Answer:
Option A -> Option AQuick Check:
Bandwidth depends directly on DAU for total data transfer [check]
Hint: Bandwidth depends directly on DAU count [check]
Common Mistakes:
5. Without a properly chosen partition key in Cassandra, what exact failure occurs when querying a large dataset?
medium
Solution
Step 1: Understand impact of partition key on data distribution
Improper partition keys cause very large partitions, leading to coordinator overload during queries.Step 2: Trace failure mode
Large partitions cause coordinator to timeout or fail when scanning data; stale data and silent write failures are unrelated; data duplication is controlled by replication, not partition key choice.Final Answer:
Option D -> Option DQuick Check:
Large partitions -> coordinator overload -> query timeouts [check]
Hint: Large partitions overload coordinator -> query timeouts [check]
Common Mistakes:
