0
0
HLDsystem_design~20 mins

Long polling and Server-Sent Events in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Long Polling and SSE Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference in connection behavior between Long Polling and Server-Sent Events

Which statement correctly describes how connections behave in Long Polling compared to Server-Sent Events (SSE)?

ALong Polling repeatedly opens and closes connections, while SSE keeps a single persistent connection open.
BBoth Long Polling and SSE keep multiple persistent connections open simultaneously.
CBoth Long Polling and SSE repeatedly open and close connections for each message.
DLong Polling keeps a single persistent connection open, while SSE repeatedly opens and closes connections.
Attempts:
2 left
💡 Hint

Think about how the client waits for messages in each method.

Architecture
intermediate
2:00remaining
Choosing between Long Polling and SSE for a live sports score app

You are designing a live sports score update system for mobile and desktop browsers. Which architecture choice is best to minimize server load and provide near real-time updates?

AUse frequent short polling every second to ensure the freshest data.
BUse Long Polling because it works well with all browsers and requires no special server setup.
CUse Server-Sent Events because it maintains a single open connection per client and efficiently pushes updates.
DUse WebSockets instead of Long Polling or SSE for simpler implementation.
Attempts:
2 left
💡 Hint

Consider connection persistence and server resource usage.

scaling
advanced
2:00remaining
Scaling challenges with Long Polling under high user load

What is the main scaling challenge when using Long Polling for thousands of simultaneous users?

ALong Polling cannot deliver messages in order, causing data inconsistency.
BMaintaining thousands of open persistent connections consumes too much memory and file descriptors.
CLong Polling requires complex client-side logic that slows down browsers.
DRepeatedly opening and closing connections causes high CPU and network overhead on the server.
Attempts:
2 left
💡 Hint

Think about what happens each time a Long Polling request completes.

tradeoff
advanced
2:00remaining
Tradeoff between SSE and Long Polling for browser compatibility and server complexity

Which tradeoff best describes the choice between Server-Sent Events and Long Polling?

ALong Polling supports bidirectional communication, while SSE only supports server-to-client messages.
BLong Polling works on all browsers but increases server complexity due to repeated connections; SSE is simpler server-side but less supported.
CSSE requires complex client-side code, while Long Polling uses simple JavaScript APIs.
DSSE has better browser support but requires more server resources than Long Polling.
Attempts:
2 left
💡 Hint

Consider browser support and server resource usage.

estimation
expert
3:00remaining
Estimating server resource usage for 10,000 SSE clients

You plan to support 10,000 simultaneous clients using Server-Sent Events. Each client keeps one open HTTP connection. Estimate the main server resource bottleneck and the best approach to handle it.

AMemory and file descriptors will be the bottleneck; use an event-driven server and increase OS limits for open files.
BCPU usage will be the bottleneck; use more powerful CPUs to handle message encoding.
CNetwork bandwidth will be the bottleneck; compress all messages aggressively to reduce size.
DDisk I/O will be the bottleneck; cache messages on disk to reduce memory usage.
Attempts:
2 left
💡 Hint

Think about what keeping many open connections requires from the operating system.