Target Server Load Balancing using Weighted algorithm not working

Hi,

I have developed a Proxy on sandbox env to play around with some feature of load balancing across target server and i was trying to implement weighted algorithm for load balancer as provided in apigee docs -https://docs.apigee.com/api-platform/deploy/load-balancing-across-backend-servers#settingloadbalanceroptions.

I have 2 target servers :

1. lb-targeta - mocktarget.apigee.net and

2. lb-targetb - httpbin.org

My proxy has following code for load balancing under default Target Endpoint:

<HTTPTargetConnection>

<LoadBalancer>

<Algorithm>Weighted</Algorithm>

<Server name="lb-targeta">

<Weight>1</Weight>

</Server>

<Server name="lb-targetb">

<Weight>2</Weight>

</Server>

</LoadBalancer>

</HTTPTargetConnection>

When I hit the proxy endpoint, I don't see the expected output of 2 request being forwarded to lb-targetb for every 1 request to lb-targeta. I can see the default behavior of round robin being applied to the proxy for above config. Is there anything that i am missing from my end?

0 4 851
4 REPLIES 4

How many requests have you sent? I imagine that the weighted load balancer applies at the message processor level, and if you've only sent a few requests, you may be getting different message processors in different states

I have send around 15+ requests.

I think you should send additional requests. If your org for example has 8 Message Processors, then you would only have on average sent 2 requests to each Message Processor yet you're distributing based on 3.

sidd-harth
Participant V

Hi @Priyanka, as mentioned by @dane knezic, you need to check the Message Processors associated with your proxy.

The Apigee API Gateway essentially consists of a routing layer (known as the router) and a processing layer (known as the message processor). The message processor is essentially the engine that receives and processes all your API requests, applies the policies to the runtime requests and serves the response.

Please refer to this topic, to check the number of processors for your proxy,

https://community.apigee.com/questions/51937/how-many-routers-and-message-processors-are-used-b.html

https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/environments/%7Benv_name....

Lets say, you made 3 calls and Apigee Router forwarded all 3 calls to same Message processor, then it is going to execute - 2 request being forwarded to lb-targetb for every 1 request to lb-targeta.