Practice
Solution
Step 1: Identify workload characteristics
Millions of writes per second and time-based queries require a storage optimized for high write throughput and efficient time-range scans.Step 2: Evaluate storage options
Relational DBs with row-level locking (A) cause write contention and poor scalability. Key-value stores (C) lack native time indexing, making time queries inefficient. Document DBs (D) without time partitioning lead to slow queries and large scans. Time-series DBs (B) are designed for append-only writes and efficient time-based queries.Final Answer:
Option B -> Option BQuick Check:
Time-series DBs optimize for time-based writes and queries [check]
Solution
Step 1: Analyze conflict resolution approaches
Vector clocks allow detection of concurrent conflicting versions without blocking writes, enabling asynchronous conflict resolution.Step 2: Eliminate other options
Centralized locking serializes writes, causing high latency and bottlenecks. Synchronous quorum writes enforce consistency but increase latency and reduce availability. Consistent hashing routes keys but does not resolve conflicts.Final Answer:
Option A -> Option AQuick Check:
Vector clocks enable asynchronous conflict detection and merging [check]
Solution
Step 1: Compare OT and CRDT for offline and distributed scenarios
OT typically requires a central server to order and transform operations, making offline support complex.Step 2: Understand CRDT advantages
CRDTs are designed for decentralized environments, allowing local operations to be merged eventually without coordination, ideal for offline edits and global distribution.Final Answer:
Option C -> Option CQuick Check:
CRDTs enable offline edits and eventual consistency without central coordination [check]
Solution
Step 1: Analyze bandwidth and latency constraints
Mobile apps benefit from minimizing data transfer and round-trips due to limited bandwidth and latency.Step 2: Compare REST and GraphQL trade-offs
REST multiple endpoints cause multiple round-trips; single endpoint REST over-fetches; GraphQL queries exactly needed fields in one request.Final Answer:
Option D -> Option DQuick Check:
GraphQL reduces over-fetching and round-trips for mobile [check]
Solution
Step 1: Identify statefulness in load balancing algorithms
Least Connections requires tracking active connections per server globally, needing frequent updates.Step 2: Analyze scaling impact
At 10x scale, the centralized connection tracker becomes a bottleneck due to synchronization overhead and contention.Step 3: Evaluate other components
IP Hash is stateless and fast; weighted lists update less frequently; Round Robin pointer is lightweight and easily sharded.Final Answer:
Option C -> Option CQuick Check:
Global connection tracking bottlenecks Least Connections at high scale [check]
