IceGrid nodes regularly report the system load of their hosts to the registry. The replica group’s configuration determines whether the registry actually considers system load information while processing a locate request. Its configuration also specifies how many replicas to include in the registry’s response.
IceGrid’s load balancing capability assists the client in obtaining an initial set of endpoints for the purpose of establishing a connection. Once a client has established a connection, all subsequent requests on the proxy that initiated the connection are normally sent to the same server without further consultation with the registry. As a result, the registry’s response to a locate request can only be viewed as a snapshot of the replicas at a particular moment. If system loads are important to the client, it must take steps to periodically contact the registry and update its endpoints.
Section 32.18.2 provides more information on this subject.
A replica group descriptor optionally contains a load balancing descriptor that determines how system loads are used in locate requests. The load balancing descriptor specifies the following information:
For example, the descriptor shown below uses adaptive load balancing to return the endpoints of the two least-loaded object adapters sampled with five-minute intervals:
Random load balancing selects the requested number of object adapters at random. The registry does not consider system load for a replica group with this type.
Adaptive load balancing uses system load information to choose the least-loaded object adapters over the requested sampling interval. This is the only load balancing type that uses sampling intervals.
Round robin load balancing returns the least recently used object adapters. The registry does not consider system load for a replica group with this type. Note that the round-robin information is not shared between registry replicas; each replica maintains its own notion of the "least recently used" object adapters.
Ordered load balancing selects the requested number of object adapters by priority. A priority can be set for each object adapter member of the replica group.
Using adaptive load balancing, we have regained the functionality we forfeited in Section 39.9.3. Namely, we now select the object adapter on the least-loaded node, and no changes were necessary in the client.
In some applications you may have a need for interacting directly with the replicas of an object. For example, the application may want to implement a custom load-balancing strategy. In this situation you might be tempted to call
ice_getEndpoints on the proxy of a replicated object in an effort to obtain the endpoints of all replicas, but that is not the correct solution because the proxy is indirect and therefore contains no endpoints. The proper approach is to use the
findAllReplicas operation provided by the
IceGrid::Query interface. See
Section 39.6.5 for more information.