Traffic
Adaptive weighting
The closest free answer to least time load balancing. The health checker is already timing every probe, so the numbers are there. This uses them.
What it does
On a cycle, each member weight is adjusted based on its recent average response time. A backend answering in 20ms ends up with a higher weight than one taking 200ms, so it gets more of the traffic. Nothing is changed inside nginx: the weights in the upstream are rewritten and nginx reloads gracefully.
The two safety rails
A feature that automatically moves traffic around can make a bad situation worse, so there are two limits on it.
- Weights only move a little each cycle, with a floor and a ceiling. One slow check cannot take a server out of rotation, and a fast one cannot end up carrying the whole pool.
- If every backend is slow, nothing changes. Everything being slow means the problem is downstream of the pool, and shifting weights around would only concentrate the load somewhere and make it worse.
An honest comparison with least time
NGINX Plus reacts per request. This reacts on a cycle, so it is minutes rather than milliseconds.
- Good fit: a pool of mixed hardware, or backends in different places, where the speed difference is consistent rather than momentary.
- Poor fit: traffic that spikes in seconds. Least connections on its own reacts faster, and you should just use that.
Start by watching
Before turning this on, look at the health check timings on the pool page for a few days. If every member is within a few milliseconds of the others, adaptive weighting has nothing to do and you are adding moving parts for no gain.
Common questions
Does this replace least connections?
No, they work together. Least connections decides where the next request goes, and the weights decide the share each backend gets.
How often does it recalculate?
On a cycle measured in minutes rather than seconds, which is deliberate. Reacting fast to noisy measurements is how you get oscillation.
Will it fight with slow start?
No. A member still ramping is left alone until it reaches its configured weight.
Step by step instructions
The how to section has searchable, task shaped answers. Search it for adaptive.
Related features
Load balancing methods
Round robin, least connections, hashing and consistent hashing.
Read moreActive health checks
Probe every backend on a schedule and pull the dead ones out.
Read moreSlow start
Ease traffic onto a server that just came back.
Read moreUtilization charts
Requests, connections, processor and memory over time.
Read more