Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

Why Round-Robin Struggles to Balance WebSockets at Scale

Round-robin can distribute WebSocket upgrades evenly but cannot rebalance established connections as their lifetimes and workloads diverge.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Round-robin can distribute new WebSocket connections evenly, but it does not keep the number of live connections—or their workload—even over time. Once a server accepts an HTTP upgrade, the WebSocket stays on that backend until it closes. Different connection lifetimes and workloads can therefore leave some servers busier than others. This is a load-distribution mismatch, not a general inability to proxy WebSockets.

Why round-robin can become uneven

In NGINX HTTP load balancing, round-robin is the default when no other method is configured. It assigns successive requests across the upstream server group. NGINX describes the distribution as more or less equal when there are enough requests, the requests have uniform work, and they finish quickly. A long-lived WebSocket does not fit that short-request assumption: the initial HTTP upgrade is brief, but the resulting connection can remain open for much longer. NGINX HTTP load balancing documentation

As an Amazon Associate I earn from qualifying purchases.

That difference matters because round-robin distributes connection starts, not ongoing socket occupancy. If one connection closes quickly while another remains open, the servers’ live connection counts can diverge even if they received similar numbers of initial connections. Differences in message rates, CPU use, bandwidth, and application work can add further imbalance; the cited documentation does not quantify those effects or identify a connection count at which imbalance becomes material.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What happens to a WebSocket after the upgrade

A WebSocket begins as an HTTP request and becomes a persistent, bidirectional connection after the server accepts the upgrade. In the Application Load Balancer case documented by AWS, the target that returns HTTP 101 handles the WebSocket connection. Frames continue over that established connection to the selected target; round-robin does not move individual frames among servers. AWS also says cookie stickiness does not apply after the upgrade. AWS Application Load Balancer target-group documentation

Which balancing method fits the workload?

Choose a method based on what it measures and what your application needs. None of these methods can guarantee equal resource use when individual sockets do different amounts of work.

Method What it uses to select a backend What to consider for WebSockets
Round-robin Successive requests are distributed across servers; it is NGINX’s default when no method is set. Distributes new connection attempts, but does not account for existing WebSocket occupancy.
Least-connected NGINX sends the next request to the server with the fewest active connections. Can help when connection count is a useful proxy for capacity, but does not account for different work per socket.
IP hash Client IP address. NGINX describes this as basic session persistence. Clients sharing an IP can concentrate on one server; affinity does not equalize resource use.
Ingress-NGINX cookie affinity A cookie-based session mapping, with either balanced or persistent behavior. Balanced mode can redistribute some sessions as a deployment scales up; persistent mode avoids rebalancing sessions to new servers and prioritizes stickiness.

NGINX notes that with round-robin or least-connected, each subsequent client request can potentially go to a different server. That matters for separate HTTP requests that depend on application state being available on the same backend. It does not mean an established WebSocket connection is reassigned between servers. Cookie or IP affinity may help with application-level session continuity, but an already-upgraded socket is inherently tied to its selected backend while it remains open. NGINX HTTP load balancing documentation AWS Application Load Balancer target-group documentation Ingress-NGINX annotations documentation

Why WebSockets may close after 60 seconds

Load balancing and connection lifetime are separate concerns. Ingress-NGINX says WebSocket support is provided out of the box, but its documented defaults for proxy-read-timeout and proxy-send-timeout are both 60 seconds. The project says values higher than one hour are more adequate for WebSockets. These are ingress-nginx-specific settings, not universal defaults for all proxies or cloud load balancers. Check the deployed release and every intermediary in the network path before changing them. Ingress-NGINX miscellaneous documentation

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If ingress-nginx is exposed through a Kubernetes LoadBalancer service, its documentation says the protocol between that load balancer and NGINX should be TCP. A timeout adjustment cannot fix a protocol or intermediary issue elsewhere along the path.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to check when servers are uneven or sockets disconnect

Use observations from the whole path to distinguish connection imbalance from timeout or application problems. Track active connections per backend alongside resource use; connection counts alone can hide unequal per-socket work.

  • Compare active WebSocket counts per backend with CPU, memory, and network utilization.
  • Review connection lifetime distributions, upgrade success, and close reasons.
  • Inspect proxy read and send timeouts at ingress and every intermediary, plus the protocol used between them.
  • Check how backends are drained or terminated during deployments and scale changes.
  • When testing a different balancing method, observe whether server selection uses new requests, active connection counts, IP, or cookies—and whether existing sessions are remapped as the server pool changes.

These checks follow from the connection and proxy behavior described in the documentation; the sources do not prescribe a complete monitoring checklist or provide comparative benchmark results.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.