Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What are real-time features in system design?
Real-time features allow a system to process and deliver information instantly or with minimal delay, enabling immediate interaction or updates.
Click to reveal answer
beginner
Name two common protocols used for real-time communication.
WebSocket and MQTT are common protocols that support real-time communication by maintaining persistent connections for instant data exchange.
Click to reveal answer
intermediate
Why is low latency important in real-time systems?
Low latency ensures that data is delivered quickly, which is crucial for user experience in applications like chat, gaming, or live updates.
Click to reveal answer
intermediate
What role does message broker play in real-time features?
A message broker routes messages between services or clients, enabling scalable and reliable real-time data delivery.
Click to reveal answer
intermediate
Explain the difference between polling and push-based real-time updates.
Polling repeatedly asks the server for updates, causing delays and overhead. Push-based updates send data instantly from server to client when changes occur, improving efficiency.
Click to reveal answer
Which protocol is best suited for maintaining a persistent real-time connection?
AWebSocket
BHTTP/1.1
CFTP
DSMTP
✗ Incorrect
WebSocket keeps a persistent connection open for instant two-way communication, unlike HTTP which is request-response.
What is the main disadvantage of polling for real-time updates?
ARequires special hardware
BHigh latency and unnecessary server load
COnly works on mobile devices
DDoes not support encryption
✗ Incorrect
Polling causes delays and wastes resources by repeatedly asking the server even when no new data is available.
Which component helps scale real-time messaging by routing messages efficiently?
ADatabase
BLoad balancer
CMessage broker
DCache
✗ Incorrect
Message brokers manage message delivery between clients and services, enabling scalable real-time communication.
Why is low latency critical in real-time systems?
ATo improve offline access
BTo reduce storage costs
CTo increase battery usage
DTo ensure fast and smooth user experience
✗ Incorrect
Low latency means data arrives quickly, which is essential for interactive applications like chat or gaming.
Which technology is commonly used for real-time updates in web browsers?
AWebSocket
BSMTP
CFTP
DTelnet
✗ Incorrect
WebSocket is widely supported in browsers for real-time two-way communication.
Describe how real-time features improve user experience in a chat application.
Think about how messages appear immediately without refreshing.
You got /4 concepts.
Explain the architecture components needed to build a scalable real-time notification system.
Consider how messages flow from server to many users quickly.
You got /5 concepts.
Practice
(1/5)
1. Which protocol is commonly used to enable real-time communication in web applications?
easy
A. SMTP
B. HTTP/1.1
C. WebSocket
D. FTP
Solution
Step 1: Understand real-time communication needs
Real-time apps require a protocol that supports two-way, instant data exchange.
Step 2: Identify protocol features
WebSocket allows full-duplex communication over a single connection, unlike HTTP/1.1 which is request-response only.
Final Answer:
WebSocket -> Option C
Quick Check:
Real-time = WebSocket [OK]
Hint: Real-time needs two-way instant data flow: WebSocket fits best [OK]
Common Mistakes:
Confusing HTTP with WebSocket for real-time
Choosing FTP or SMTP which are not real-time protocols
Thinking HTTP/2 is the same as WebSocket
2. Which component in a real-time system is responsible for distributing messages from producers to consumers?
easy
A. Broker
B. Producer
C. Consumer
D. Database
Solution
Step 1: Define roles in real-time messaging
Producers send data, consumers receive data, and brokers route messages between them.
Step 2: Identify the distributor
The broker acts as the middleman ensuring messages reach the right consumers.
Final Answer:
Broker -> Option A
Quick Check:
Message routing = Broker [OK]
Hint: Broker connects producers and consumers by routing messages [OK]
Common Mistakes:
Confusing producer as distributor
Thinking consumer sends messages
Assuming database handles message routing
3. Consider a chat app using WebSocket. If the server receives a message from User A and broadcasts it to 100 connected users, what is the main bottleneck to scale this real-time feature?
medium
A. User A's device speed
B. Client browser rendering speed
C. Database read latency
D. Server CPU and network bandwidth
Solution
Step 1: Analyze message flow in real-time chat
The server receives and then sends the message to all connected users, requiring CPU and network resources.
Step 2: Identify bottleneck
Server CPU handles message processing; network bandwidth handles sending to many users simultaneously.
Final Answer:
Server CPU and network bandwidth -> Option D
Quick Check:
Scaling real-time = Server resources [OK]
Hint: Server resources limit broadcast scale, not client or DB speed [OK]
Common Mistakes:
Blaming client device speed for server load
Focusing on database latency which is less critical here
Ignoring network bandwidth limits
4. A real-time notification system uses MQTT but users report delayed messages. Which is the most likely cause?
medium
A. Clients are using WebSocket instead of MQTT
B. Broker is overloaded and dropping messages
C. Messages are too small to send quickly
D. Users have disabled notifications on their devices
Solution
Step 1: Understand MQTT broker role
The broker routes messages; if overloaded, it queues or drops messages causing delays.
Step 2: Evaluate other options
Clients using WebSocket instead of MQTT would cause connection issues, not delays; small messages send faster; disabled notifications affect display, not delivery.
Final Answer:
Broker is overloaded and dropping messages -> Option B
Quick Check:
Delays usually mean broker overload [OK]
Hint: Delays often mean broker overload, not client protocol mismatch [OK]
Common Mistakes:
Blaming client protocol mismatch for delays
Assuming small messages cause delays
Ignoring broker capacity limits
5. You are designing a real-time stock price update system for millions of users. Which approach best ensures scalability and low latency?
hard
A. Use a distributed message broker cluster with topic partitions and WebSocket connections
B. Store all prices in a single database and poll clients every second
C. Send updates via email to all users when prices change
D. Use HTTP long polling from clients to server for updates
Solution
Step 1: Understand scalability needs
Millions of users require distributed systems to handle load and maintain low latency.
Step 2: Evaluate options
Distributed brokers with topic partitions allow parallel processing; WebSocket supports instant push updates. Polling and email cause delays and high load.
Final Answer:
Use a distributed message broker cluster with topic partitions and WebSocket connections -> Option A