What is the exact effect of 'Weight' with NodeBalancers?
https://www.linode.com/docs/guides/nodebalancer-reference-guide/#nodes
Weight - Each of these nodes will also have a weight assigned to it that determines how connections will be balanced to it. Nodes with a higher weight will receive more connections than nodes with a lower weight.
I would guess that with 2 Linodes and a weight of 2 vs 1, the "round robin" algorithm would send twice the amount of traffic to the first as compared to the second. But what effect does weight have with "least connections" or "source IP" algorithms?
3 Replies
Weight plays into each algorithm a bit differently, so I’ll break this down below to provide more detail on how weight is applied.
Round Robin
You’re correct in that these connections will be applied proportional to each backend’s weight. Of all the algorithms, this one is most straightforward.
Least Connections
Tracks each backend Linode’s connection count, and allocates new connections to the node with the least connections.
When it comes to Least Connections, a Round-Robin like allocation will still come into play when you’re dealing with backends that have an equal load, and therefore “least connections” cannot be established. In this instance the initial connection will be allocated to nodes according to their weight.
Source IP
Modulates the client’s IP to allocate them to the same backend on subsequent requests. This works so long as the set of backend Linode doesn’t change, however Session Stickiness affects this behavior.
This algorithm focuses more on subsequent connections rather than the first connection. In order to establish the initial connection to a client, the node’s weight will be factored in. After that, though, the weight is insignificant as the client will continue to connect to the same backend node, as long as the connection isn't interrupted by a change to the backend.
@jtoscani thanks for your answer!
And is it possible to use weight as an order Backup nodes go into the game?
Eg: 1 Active node, 2 and 3 node in Backup, while of 1 is down -> 2 takes traffic, if 1 and 2 down -> 3.
Same question as 2naive - I need to understand how to ensure a Node I've added is used as last resort. Situation I have:
I have a pair of production servers, web1 & web2. I have 2 ports listening on each server - 80 and 81. 80 is for regular traffic, 81 is configured to serve a read only copy of the sites should a database issue occur on a third database server.
So - I need to have 4 nodes; Primary (web1:80), Backup 1 (web2:80) - then Backup 2 (web1:81) and Backup 3 (web2:81)
Backups 2 and 3 should only ever be attempted if Primary and Backup1 fail.