'How to give priority to server hosted on same machine while routing traffic using Apache mod_proxy_balancer?
I am planning to use Apache mod_proxy_balancer to load balance traffic between internal services.
An example topology looks something like the following.
Service A (host 1) ___ __ Service B (host 1)
Service A (host 2) ___|____> mod_proxy_balancer >___|__ Service B (host 2)
Service A (host 3) ___| |__ Service B (host 3)
Note that there are 3 hosts and all of the are hosting instances of Service A and Service B. I want the routing logic where Service B on the same host should be given priority while routing the requests coming from Service A.
For example, requests from Service A on host 1 should be routed to Service B on host 1 as far as it is available. If Service B on host 1 is not available then and only then the request should be routed to one of the other available instances.
Is there a way to achieve this use case using Apache mod_proxy_balancer? I have checked various scheduling algorithms mentioned on the official docs https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html. Can not see any of the algorithm specifically handling this use case. Not sure whether https://httpd.apache.org/docs/2.4/mod/mod_lbmethod_heartbeat.html can be useful here as heartbeat response from the same host should be relatively faster?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
