# Overview In real-time updates, you must consider 2 hops: #flashcard 1. The server sending updates to the client 2. The server getting triggered when an update is available <!--ID: 1752427993455--> # Key Considerations ## [[Layer 4 Load Balancer]] vs. [[Layer 7 Load Balancer]] #flashcard The choice between L4 and L7 load balancers often comes up in system design interviews when discussing real-time features. There are some L7 load balancers which explicitly support connection-oriented protocols like WebSockets, but generally speaking L4 load balancers are better for WebSocket connections, while L7 load balancers offer more flexibility for HTTP-based solutions like long polling. <!--ID: 1752427993519--> Real-time updates decision flow... #flashcard - If you're not latency sensitive, **simple polling** is a great baseline. You should probably start here unless you have a specific need in your system. - If you don't need bi-directional communication, **SSE** is a great choice. It's lightweight and works well for many use cases. There are some infrastructure considerations to keep in mind, but they're less invasive than with WebSocket and generally interviewers are less familiar with them or less critical if you don't address them. - If you need frequent, bi-directional communication, **WebSocket** is the way to go. It's more complex, but the performance benefits are huge. - Finally, if you need to do audio/video calls, **WebRTC** is the only way to go. In some instances peer-to-peer collaboration can be enhanced with WebRTC, but you're unlikely to see it in a system design interview. <!--ID: 1752427993523--> ## The server getting triggered when an update is available... #flashcard 1. Pulling via Polling 1. Great when you want your user experience to be somewhat more responsive to changes that happen on the backend, but responding quickly is not the main thing. Generally speaking, if you need real-time updates this is not the best approach 2. Pushing via Consistent Hashes 3. Pushing via Pub/Sub <!--ID: 1752428563882--> # Implementation Details # Useful Links # Related Topics ## Reference #### Working Notes #### Sources