System Design Concepts: Messaging, Storage Choices, and Concurrency
Context: You are designing distributed services that communicate via events and must handle bursty traffic, data storage trade-offs, and concurrency challenges.
1) Message Queues
Explain the role of message queues in:
-
Decoupling producers and consumers
-
Smoothing traffic spikes (load leveling)
2) Delivery Semantics
Define delivery semantics and describe how to achieve each in practice:
-
At-least-once
-
At-most-once
-
Exactly-once
3) Push vs. Pull Consumption
Compare push vs. pull event delivery models. Discuss trade-offs for:
-
Latency
-
Throughput
-
Backpressure
-
Client complexity
4) Storage Choice: NoSQL vs. Relational
When would you choose a NoSQL datastore over a relational database? Discuss:
-
Data models
-
Consistency models
-
Scaling
-
Query patterns
5) Deadlocks
Define a deadlock in concurrent or distributed systems and outline techniques to prevent, avoid, detect, and recover from it.