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 |
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
