Quick information on the TargetLoadBalancing feature usage:
- Management API to check to a target is reachable or not. Configure the target info(ip & port) as a target server under an environment & use the following MGMT api to check whether the target(connection) is reachable or not.
POST v1/organizations/{organization}/environments/{environment}/targetservers/{targetserver}/?action=test
- LB configuration to mark a target as down & take it out of the target list serving the runtime requests.
LoadBalancer configuration (as shown below) used to determine the no of the times a target should be checked for availability before marking it as down & take it out of the available target list.
<TargetEndpoint name="default">
<HTTPTargetConnection>
<LoadBalancer>
<Algorithm>RoundRobin</Algorithm>
<Server name="target1" />
<MaxFailures>5</MaxFailures>
<Server name="target2" />
</LoadBalancer>
<Path>/test</Path>
</HTTPTargetConnection>
</TargetEndpoint>
- Monitoring support in TargetLoadBalancing
With HealthMonitoring configured support (TCP or HTTP based), the target backup/availability check can be achieved after it has been marked as down.
& configurations can be used to check for the target availability on a scheduled interval & add it back into the available target list.
Also to handle target (reachable)failures, In the configuration, one of the target servers can be configured as a backup/fallback server (highly available) i.e in case none of configured target server is available in the target list, the fallback server will be always in place to serve the requests.
<TargetEndpoint name="default">
<HTTPTargetConnection>
<HealthMonitor>
<IsEnabled>true</IsEnabled>
<IntervalInSec>5</IntervalInSec>
<TCPMonitor>
<ConnectTimeoutInSec>10</ConnectTimeoutInSec>
<Port>80</Port>
</TCPMonitor>
</HealthMonitor>
. . .
More details on the loadbalancer(monitoring,fallback) configuration :
[http://apigee.com/docs/api-services/content/load-balancing-across-backend-servers](http://apigee.com/docs/api-services/content/load-balancing-across-backend-servers)