API / APIGEE Gateway Interview Questions
How does load balancing and health checking work on Apigee TargetEndpoints?
Apigee supports client-side load balancing across multiple backend Target Servers directly within the TargetEndpoint configuration. This provides basic resilience and failover without requiring an external load balancer between Apigee and the backend.
<!-- TargetEndpoint with load balancing across 3 servers --> <TargetEndpoint name="default"> <HTTPTargetConnection> <LoadBalancer> <Algorithm>RoundRobin</Algorithm> <!-- or: LeastConnections, Weighted, Random --> <Server name="backend-1"/> <Server name="backend-2"/> <Server name="backend-3"> <Weight>2</Weight> <!-- Receives 2x the traffic (Weighted algorithm) --> </Server> <!-- Health check / retry configuration --> <MaxFailures>5</MaxFailures> <RetryEnabled>true</RetryEnabled> <IsFallback>false</IsFallback> </LoadBalancer> <Path>/api/v1</Path> </HTTPTargetConnection> <!-- Active health checks (HealthMonitor) --> <HealthMonitor> <IsEnabled>true</IsEnabled> <IntervalInSec>5</IntervalInSec> <HTTPMonitor> <Request> <ConnectTimeoutInSec>2</ConnectTimeoutInSec> <SocketReadTimeoutInSec>2</SocketReadTimeoutInSec> <Verb>GET</Verb> <Path>/health</Path> </Request> <SuccessResponse> <ResponseCode>200</ResponseCode> </SuccessResponse> </HTTPMonitor> </HealthMonitor> </TargetEndpoint>
| Algorithm | Behaviour |
|---|---|
| RoundRobin | Cycles through servers in order (default) |
| LeastConnections | Routes to server with fewest active connections |
| Weighted | Routes proportionally based on Weight values |
| Random | Random server selection per request |
More Related questions...