A12Intermediate
Queues and Async Processing
30 minWhen designing new features
Format: Determine which operations should be synchronous and which should be asynchronous.
Scenario: A user publishes a post in your app. Which of the following operations should be synchronous, and which asynchronous?
| Operation | Sync or Async? | Your Reasoning |
|---|---|---|
| Save post to database | ? | |
| Return "published successfully" to user | ? | |
| Send push notifications to followers | ? | |
| Generate post thumbnail | ? | |
| Update user's post count | ? | |
| AI content moderation of the post | ? | |
| Update search index | ? | |
| Send data to analytics system | ? |
Core Principle:
- Synchronous: Operations where the user is waiting for the result (save data, return response)
- Asynchronous: Operations where the user doesn't need to see the result immediately (notifications, analytics, post-processing)
Analogy: In a restaurant, "placing your order" is synchronous (you need confirmation), but "the kitchen cooking your food" is asynchronous (you don't need to stand in the kitchen and watch).