Load Balancing across DCs/Labs with different numbers of servers

1 0 538

A question that occasionally comes up is how to Load Balance within DCs or Labs which have varying numbers of backend targets. Say your Dev Lab has 1 backend, your Test Lab has 2 back ends, and your Prod DC has 3 back ends. How do you configure Load Balancing so that the Proxy Bundle does *not* have to be changed as it is moved through these environments?

[NOTE: this assumes you are familiar with the Load Balancing configurations discussed here:

http://apigee.com/docs/api-services/content/load-balancing-across-backend-servers]

One way to do this is to configure the LoadBalancer blocks in the the proxy for the greatest number of servers; in this case, it would be the Prod DC environment, like this:

<TargetEndpoint name="default">

<HTTPTargetConnection>

<LoadBalancer>

<Server name="target1" />

<Server name="target2" />

<Server name="target3" />

</LoadBalancer>

<Path>/test</Path>

</HTTPTargetConnection>

</TargetEndpoint>

In the Prod environment then, each of your target servers points at one of each of the target backend servers:

<TargetServer name="target1">

<Host>1.mybackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

<TargetServer name="target2">

<Host>2.mybackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

<TargetServer name="target3">

<Host>3.mybackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

However, in the Dev/Test labs, the target server definitions may point to the same backend(s):

Dev:

<TargetServer name="target1">

<Host>1.mydevbackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

<TargetServer name="target2">

<Host>1.mydevbackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

<TargetServer name="target3">

<Host>1.mydevbackendservice.com</Host>

<Port>80</Port>

<IsEnabled>true</IsEnabled>

</TargetServer >

When a bundle configured as above is propagated from one environment to the next, the server definitions in that environment are different, and the same bundle, with no code changes, will pick up the appropriate server definitions.

There are other, more complex, schemes for handling this, but the simplicity of the configuration and the low operational maintenance requirements make this a preferred pattern in most cases.

Version history
Last update:
‎08-07-2015 09:15 AM
Updated by: