Util

class LoadBalancer[source]

Bases: object

Load balancer allows you to send operations to one of a number of endpoints (Members). It is up to the implementation to use different load balancing policies.

If the client is configured with smart routing, only the operations that are not key based will be routed to the endpoint

init(cluster_service)[source]

Initializes the load balancer.

Parameters

cluster_service (hazelcast.cluster.ClusterService) – The cluster service to select members from

next()[source]

Returns the next member to route to.

Returns

the next member or None if no member is available.

Return type

hazelcast.core.MemberInfo

class RoundRobinLB[source]

Bases: hazelcast.util._AbstractLoadBalancer

A load balancer implementation that relies on using round robin to a next member to send a request to.

Round robin is done based on best effort basis, the order of members for concurrent calls to the next() is not guaranteed.

next()[source]

Returns the next member to route to.

Returns

the next member or None if no member is available.

Return type

hazelcast.core.MemberInfo

class RandomLB[source]

Bases: hazelcast.util._AbstractLoadBalancer

A load balancer that selects a random member to route to.

next()[source]

Returns the next member to route to.

Returns

the next member or None if no member is available.

Return type

hazelcast.core.MemberInfo