Practice
Solution
Step 1: Identify Consistency role
Consistency ensures database state adheres to all defined rules and constraints after transaction commits.Step 2: Differentiate from other ACID properties
Atomicity ensures all-or-nothing commit, Isolation controls concurrent access, Durability ensures persistence, but only Consistency enforces business rules.Final Answer:
Option A -> Option AQuick Check:
Consistency enforces schema and business rules post-commit [check]
Solution
Step 1: Identify Kafka's role in ordering and decoupling
Kafka partitions messages by group chat ID, preserving ordering per group and decoupling producers from consumers.Step 2: Eliminate other options
Relational DB with locking can't handle 1M writes/sec; Redis Pub/Sub lacks durability; HTTP polling adds latency and load.Final Answer:
Option B -> Option BQuick Check:
Kafka partition key -> ordering per group, decoupled delivery [check]
Solution
Step 1: Identify durability and scale needs for raw uploads
Raw uploads require durable, scalable storage that can handle large binary files and high concurrency. Redis (Use an in-memory cache like Redis to store raw uploads temporarily) is in-memory and not durable for large files. Relational DBs (Store raw uploads directly in a relational database for strong consistency) are inefficient for large blobs and scale poorly. CDN edge caches (Use a CDN edge cache to hold raw uploads before transcoding) are for delivery, not upload storage.Step 2: Recognize object storage suitability
Distributed object storage like S3 provides durability, scalability, and cost-effective storage for large files, making it ideal for raw uploads before transcoding.Final Answer:
Option C -> Option CQuick Check:
Object storage ensures durable, scalable raw upload storage [check]
Solution
Step 1: Identify stateless server benefits
Stateless servers allow horizontal scaling without session affinity, reducing latency and complexity.Step 2: Evaluate session management
External session storage decouples session state from servers, enabling load balancer to distribute requests evenly.Final Answer:
Option B -> Option BQuick Check:
Stateless servers + external session store -> scalable, low-latency [check]
Solution
Step 1: Role of transaction log (WAL)
The WAL records all changes before commit to enable redo/undo during crash recovery.Step 2: Consequence of missing WAL
Without WAL, committed transactions might not be replayed, causing partial or lost updates and inconsistency.Final Answer:
Option A -> Option AQuick Check:
Missing WAL -> lost committed transactions, inconsistent state [check]
