Practice
1. For a system requiring strict consistency on command handling but eventual consistency on query side, which architecture best fits?
medium
Solution
Step 1: Understand consistency requirements
Strict consistency on commands requires immediate validation; eventual consistency on queries allows asynchronous updates.Step 2: Evaluate architectures
CQRS with event sourcing separates command and query models, enabling strict command consistency and eventual query consistency.Final Answer:
Option A -> Option AQuick Check:
CQRS + event sourcing -> strict command, eventual query consistency [check]
Hint: CQRS splits command and query for tailored consistency [check]
Common Mistakes:
2. If the client fails to validate the server's certificate chain during the TLS handshake, what is the most likely failure observed in the connection?
medium
Solution
Step 1: Understand client certificate validation failure
If the client detects an invalid certificate chain, it aborts the handshake and terminates the connection to prevent insecure communication.Step 2: Analyze options
The client proceeds with encrypted communication but logs a warning is incorrect because clients do not proceed with encryption if validation fails. The server retries sending the certificate chain automatically is incorrect; servers do not retry sending certificates automatically. The client falls back to unencrypted HTTP automatically is incorrect because clients do not downgrade to HTTP automatically.Final Answer:
Option C -> Option CQuick Check:
Client aborts handshake on certificate validation failure [check]
Hint: Certificate validation failure -> handshake abort, no fallback [check]
Common Mistakes:
3. At 10x scale, which component in a real-time chat system fails first and why?
hard
Solution
Step 1: Identify stateful bottlenecks at scale
Chat servers maintain WebSocket connections bound to server memory, making horizontal scaling and resharding difficult.Step 2: Compare other components
Databases (The database fails first due to increased query volume and locking) can be scaled with sharding and replicas. Load balancers (The load balancer fails first due to inability to distribute traffic evenly) scale horizontally. Message queues (The message queue fails first due to partition key hotspots causing uneven load) can rebalance partitions.Step 3: Conclude first failure point
Chat servers hit connection limits first due to stateful nature and sticky sessions.Final Answer:
Option D -> Option DQuick Check:
Stateful WebSocket servers -> scaling bottleneck [check]
Hint: Stateful WebSocket servers block scaling; stateless scale easier [check]
Common Mistakes:
4. At 10x traffic scale, which component in HTTPS connections is most likely to become the bottleneck first, and why?
hard
Solution
Step 1: Identify TLS handshake cost at scale
Each new HTTPS connection requires a TLS handshake involving CPU-intensive asymmetric cryptography, which becomes a bottleneck as connection volume grows.Step 2: Eliminate other options
The DNS resolver, because it cannot cache enough domain lookups is less likely as DNS caching mitigates lookup load. The web application server's database, due to increased query volume is unrelated to TLS overhead. The client browsers, because they cannot handle multiple simultaneous TLS sessions is client-side and not the first bottleneck in server scaling.Final Answer:
Option B -> Option BQuick Check:
TLS handshake CPU cost limits server scaling first [check]
Hint: TLS handshake CPU cost -> first bottleneck at scale [check]
Common Mistakes:
5. At 10x scale, which component in a relational database system is most likely to fail first and why?
hard
Solution
Step 1: Identify scaling bottlenecks
At 10x scale, contention on locks and transaction coordination overhead increase dramatically.Step 2: Why transaction coordinator fails first
Locking and coordination cause blocking and deadlocks, limiting throughput before storage or connection limits.Final Answer:
Option C -> Option CQuick Check:
Transaction coordinator bottlenecks due to lock contention at scale [check]
Hint: Lock contention chokes transaction coordinator first at scale [check]
Common Mistakes:
