Loadbalancer vs URL

Hi There,

When to use the below Loadbalancer with Servername(i) and URL(ii) in the HTTPTargetConnectiion, since it appears to be used in different usecase, what was that,pls advice?

i)
<HTTPTargetConnection>
<LoadBalancer>
<Servername="hpid_target"/>
</LoadBalancer>
<Path>/scim/v2/Clients</Path>
</HTTPTargetConnection>
--------------------------------

ii)   <HTTPTargetConnection>
        <Properties/>
        <URL>https://mocktarget.apigee.net</URL>
    </HTTPTargetConnection>
0 5 487
5 REPLIES 5

Did you check the documentation on this?

Hi, I didn't check the documentation, but the first example, the load balancer does not "encapsulate" the server and is only one server, load balancer is unlike that. you must define at least two servers within that. The second example, is a simple target endpoint without load balancer, if the target server is not available, so you will get an error about connection.

Cleison Melo

Bit unclear,what do you mean by "the load balancer does not "encapsulate" the server and is only one serve".Let say I've provided by my backed core API team with only one vip i,e https://apiresources.com/v1/api/getUser that in that case should i use 1st or second option?You might say 2nd option,if it was then what be the usecase for first option? thanks

Hi @Popleys

Please do check out the docs here, our docs team does a great job!

https://docs.apigee.com/api-platform/deploy/load-balancing-across-backend-servers#configuringatarget...

The most common use case or best practice for a TargetEndpoint is to use a TargetServer(s) configured for each org / env that follows your SDLC phases. For example a TargetServer named "SCIM-v2" would have different Host values for different backends (e.g. scim-v2-dev.exco.com, scim-v2-prod.exco.com) for each SDLC phase (dev, prod).

Then, your proxy uses the named TargetServer and does not need to change as you deploy it to a different org / env, you just need to configure the TargetServer in each org / env. This simplifies CI/CD as you include TargetServer configuration items in your source code and you do not need to do any on the fly changes, as you would if you used a URL.

Hope that helps.

Not applicable

When you have only one backend then this will not make much differences. But yes this will be a good practice to use load balancer variable, that will provide more flexibility during environment promotion of proxy. You will not have to change the code, you can configure target server using management api call also.

When there are multiple backends available for one target endpoint, in that case you cannot use URL. If you use load balancer variables there it will allow to add more urls.

Other than that it will provide you 3 algorithms to load balance between the target servers. It also provides fallback, retry, monitoring etc. features.