Clusters and Load Balancers
Load balancing enables the distribution of messages received across the API Gateway nodes. Clustering helps in attaining the high availability functionality as well as load balancing. In addition, a cluster provides fault tolerance that ensures recovery of events and metrics in case a node goes down. If you have a web service that is hosted at two or more endpoints, you can use the load balancing option to distribute requests across the nodes. Requests are distributed across multiple nodes and are routed based on the round-robin execution strategy.
In a load balanced system, calls from an application are distributed across two or more different instances of API Gateway, referred to as nodes. Each node is an instance of API Gateway running on an instance of Integration Server.
If you cluster API Gateway instances, you must configure API Gateway with the load balancer URL appropriately for it to report the API address at the load balancer URL instead of having direct access address with API Gateway.
Load Balancer URLs
Load balancer URLs are the URLs of the load balancer where the requests are sent by the applications. When an API is activated on a node of a cluster, the endpoint of the API is provided as the load balancer URL instead of the Gateway end point. API Gateway stores this load balancer URL endpoint. Since all nodes of an API Gateway cluster are syncronized with APIs, each API Gateway accepts the message when routed from the load balancer to any node in the cluster.
A load balancer URL consists of a host name (or IP address) and port number of the load balancer in the following format:
http://hostname:portnumber
or
http://IP-address:portnumber
For example, if the host name of the load balancer is ExampleHost, and its port number is 80, the load balancer URL would be http://ExampleHost:80
You must configure any one node in a cluster with the same load balancer URL. The load balancer URLS are automatically synchronized on all the nodes in a cluster.
Note:
When a Load Balancer URL is updated in API Gateway, a logout and re-login or opening a new session reflects the updated artifacts URL under Specifications. The artifacts downloaded without a new session also show the updated endpoints.
You can also configure the load balancer URL to use the Web application URL, HTTPS protocol, or WebSocket port configuration.