The Load-balanced Endpoint distributes the messages (load) arriving at it among a set of listed endpoints or static members by evaluating the load balancing policy and any other relevant parameters.
|Table of Contents|
You can configure the Load-balance endpoint using XML. Click on the "Switch to source view" link in the "Load Balance Group" page.
<loadBalance [policy="roundRobin"] [algorithm="impl of org.apache.synapse.endpoints.algorithms.LoadbalanceAlgorithm"]
<member hostName="host" [httpPort="port"] [httpsPort="port2"]>+
The Load-balance attributes and elements:
policy attribute of the load balance element specifies the load balance policy (algorithm) to be used for selecting the target endpoint or static member.
Currently only the
roundRobin policy is supported.
failover attribute determines if the next endpoint or static member should be selected once the currently selected endpoint or static member has failed, and defaults to true.
loadBalance element allows to list the set of endpoints or static members among which the load has to be distributed. These endpoints can belong to any endpoint type (see Address Endpoint, WSDL Endpoint, Default Endpoint,Failover Endpoint). For example, Failover Endpoints can be listed inside the Load-balance endpoint to load balance between failover groups etc.
loadBalance element cannot have both endpoint and member child elements in the same configuration. In the case of the member child element, the
httpsPort attributes could be specified.
- The optional
session element makes the endpoint a session affinity based load balancing endpoint. If it is specified, sessions are bound to endpoints in the first message and all successive messages for those sessions are directed to their associated endpoints.
Currently there are two types of sessions supported in SAL endpoints. Namely HTTP transport based session which identifies the sessions based on HTTP cookies and the client session which identifies the session by looking at a SOAP header sent by the client with the
failover attribute mentioned above is not applicable for session affinity based endpoints and it is always considered as set to false. If it is required to have failover behavior in session affinity based load balance endpoints, list failover endpoints as the target endpoints.
1. In the "Add Endpoint" list, click "Load Balance Group Endpoint" (See Adding an Endpoint). The "Load Balance Group Endpoint" page appears.
The following fields are specific to the Load Balance Group Endpoint:
- Endpoint Name - A unique name of the endpoint.
- Algorithm - Either a default "Round-robin" or custom loaded algorithm of the group. See more information about this algorithm in the article.
- Session Management- A session management method from the load balancing group. The possible values are:
- None - Session management is not used.
- Transport - Session management is done on the transport level using HTTP cookies.
- SOAP - Session management is done using SOAP sessions.
- Client ID - Session management is done using an ID sent by the client.
- Session Timeout(ms) - Session timeout in milliseconds.
- Load Balance Endpoint Properties - See Adding an Endpoint.
2. Click "Add Endpoint."
3. A shortcut menu with the available endpoints appears.
4. Click on the endpoint you want to add as a Load Balance Group Endpoint. A tab with the fields relevant to the selected endpoint appears.
See the details of child endpoints in Address Endpoint, WSDL Endpoint, Failover Endpoint.
You can add as many endpoints as you need to the load balancing group.
Description of the Load-balance Endpoint in WSO2 ESB.