Web / NGINX Interview questions
When would you choose round robin over least_conn load balancing?
Round robin works well when backend requests are roughly uniform in cost - similar processing time and resource use - and all servers in the pool have comparable capacity. It's simple, predictable, and has no per-request bookkeeping overhead.
least_conn is the better choice when request processing times vary significantly, or when some connections are long-lived, like WebSocket sessions or streaming responses. Round robin would keep assigning new requests to a server already busy with slow, held-open connections, unevenly loading it. least_conn actively tracks open connections per server and sends new traffic to whichever currently has the fewest, correcting for that imbalance.
As a rule of thumb: round robin for short, uniform HTTP requests; least_conn for workloads with variable request duration or persistent connections.
More Related questions...