-
Notifications
You must be signed in to change notification settings - Fork 211
Balancing
Balancing strategy is a way gobetween select backends (from discovery backends pool) for new client connection. It's defined in balance
property within [servers.<name>]
, and is weight
by default.
Select backend from discovery pool with probability based on backends weights. For example, for backends pool:
[
"host1 weight=1"
"host2 weight=2"
]
host1 will be selected with probability 75%, and host2 will be selected in 25% cases.
If weight for all backends are the same, backend will be selected randomly.
Target backend will be calculated using hash function of client ip address mod backends count. Note if backends pool changes (for example, due discovery), client may be proxied to a different backend.
gobetween will select backends with least connections to it.
It's most simple balancing strategy, and each new connection will be proxies to next backend in the backends pool successively.