0
0
HLDsystem_design~5 mins

Long polling and Server-Sent Events in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is long polling in web communication?
Long polling is a technique where the client sends a request to the server and waits for the server to respond only when new data is available, keeping the connection open for a longer time instead of immediately responding.
Click to reveal answer
intermediate
How do Server-Sent Events (SSE) differ from long polling?
Server-Sent Events allow the server to push updates to the client over a single, long-lived HTTP connection without the client repeatedly requesting data, unlike long polling where the client must send new requests after each response.
Click to reveal answer
intermediate
Name one advantage of using Server-Sent Events over WebSockets.
Server-Sent Events are simpler to implement for unidirectional data flow from server to client and work over standard HTTP, making them easier to use with existing infrastructure and proxies.
Click to reveal answer
beginner
What happens if the server has no new data during a long polling request?
The server holds the request open until new data is available or a timeout occurs, then responds to the client. The client then immediately sends a new request to continue waiting for updates.
Click to reveal answer
advanced
Why might long polling cause more server load compared to Server-Sent Events?
Because long polling requires the client to repeatedly open new HTTP connections after each response, it can create more overhead and resource usage on the server compared to a single persistent connection used by Server-Sent Events.
Click to reveal answer
Which technique keeps a single HTTP connection open for continuous data flow from server to client?
ARegular polling
BLong polling
CServer-Sent Events
DFTP
In long polling, what does the client do after receiving a response from the server?
ACloses the connection and sends a new request
BKeeps the connection open indefinitely
CSwitches to WebSocket protocol
DSends no further requests
Which of the following is a limitation of Server-Sent Events?
AOnly supports unidirectional communication from server to client
BRequires multiple HTTP connections
CDoes not work over HTTP
DCannot handle text data
Why might long polling be less efficient than Server-Sent Events?
ABecause it requires WebSocket support
BBecause it uses multiple HTTP requests and responses
CBecause it uses a single persistent connection
DBecause it only works with FTP
Which scenario is best suited for Server-Sent Events?
ADownloading large files
BTwo-way chat application
CFile upload from client to server
DLive news feed updates from server to many clients
Explain how long polling works and describe its request-response cycle.
Think about how the client waits for data and how the server responds.
You got /4 concepts.
    Compare Server-Sent Events and long polling in terms of connection management and data flow.
    Focus on how connections are kept open and how data is sent.
    You got /4 concepts.