Upstream and Load Balancing

Hi,

I just wanted to ask regarding the upstream and load balancing. I have tested this out using 3 targets.

Example:

Upstream name : service.v1
Target 1 : XXX.XX.XX.001 - Hosts API service 2
Target 2 : XXX.XX.XX.002 - Hosts API service 1
Target 3 : XXX.XX.XX.003 - Hosts API service 1

URIs : /items/\d+

This is setup is currently working. However I noticed something and I am not sure if the behavior should be that way.

Target 2 and Target 3 has the same API deployed, with an endpoint of /items/\d+.
While Target 1 has a totally different API. it doesn’t contain any endpoint of /items/\d+.

However, when I use curl it still hits Target 1. My assumption is that, defining the URIs will limit the endpoints to that particular definition (in this case /items/\d+).
Can any one help me?

Thank you in advance.

As you’ve found, the load balancing round-robins between the component target members of the upstream. In your scenario, you should probably define an alternative upstream name of “service.v2” that contains the alternative service 2’s URI.

1 Like