yyyar / gobetween

:cloud: Modern & minimalistic load balancer for the Сloud era
http://gobetween.io
Other
1.91k stars 210 forks source link

Specify which server to use for specific host requests. #335

Open Spamm00r opened 1 year ago

Spamm00r commented 1 year ago

Hi,

I have go between installed to spread load over 4 different servers. This works fine, but I want outgoing requests to for example myserver.com or a whitelist of hosts to go always over the same server instead of using roundrobin or random allocation of my 4 servers.

Is this somehow possible with the current gobetween settings or can this be implemented?

That would be very helpful.

RupeshSangoi commented 1 year ago

Did you try balance=iphash or iphash1. This should work.

Spamm00r commented 1 year ago

iphash or iphash1 routes all traffic over the same backend instead of spreading it over all the backends, because the traffic is coming from the same client IP.

I can achieve the same thing by dropping gobetween and making direct connections. That's not what I want.

On the contrary, I want 99% of all my outgoing connections through gobetween to be balanced over all my backends, and preferably using the fastest backend available. Right now I achieve this by using roundrobin.

Only for specific requests to certain websites, where it is necessary to always have the same IP, I want gobetween to always use the same Backend instead of a random one. If I use roundrobin on these connections, I will be requesting always with a random IP of one of my Backends. I want to control and ensure what backend these specific connections use and not leave it to roundrobin.