Package org.apache.geode.cache.util
Class AutoBalancer
java.lang.Object
org.apache.geode.cache.util.AutoBalancer
- All Implemented Interfaces:
Declarable
@Experimental("The autobalancer may be removed or the API may change in future releases")
public class AutoBalancer
extends Object
implements Declarable
Re-balancing operation relocates data from heavily loaded members to lightly loaded members. In
most cases, the decision to re-balance is based on the size of the member and a few other
statistics.
AutoBalancer monitors these statistics and if necessary, triggers a
re-balancing request. Auto-Balancing is expected to prevent failures and data loss.
This implementation is based on ConfigInitialization implementation. By default
auto-balancing is disabled. A user needs to configure AutoBalancer during cache
initialization GemFireCache.getInitializer()
In a cluster only one member owns auto-balancing responsibility. This is achieved by grabbing a distributed lock. In case of a failure a new member will grab the lock and manage auto balancing.
AutoBalancer can be controlled using the following configurations
SCHEDULE- TBD THRESHOLDS
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Objectstatic final StringName of the DistributedLockService thatAutoBalancerwill use to guard against concurrent maintenance activitystatic final intDefault value ofMINIMUM_SIZE.static final intDefault value ofSIZE_THRESHOLD_PERCENT.static final StringIn the initial data load phases,SIZE_THRESHOLD_PERCENTbased rebalance invocation may be unnecessary.static final StringUse this configuration to manage out-of-balance audit frequency.static final StringUse this configuration to manage re-balance invocation. -
Constructor Summary
ConstructorsConstructorDescriptionAutoBalancer(org.apache.geode.cache.util.AutoBalancer.AuditScheduler scheduler, org.apache.geode.cache.util.AutoBalancer.OOBAuditor auditor, org.apache.geode.cache.util.AutoBalancer.TimeProvider clock, org.apache.geode.cache.util.AutoBalancer.CacheOperationFacade cacheFacade) -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()org.apache.geode.cache.util.AutoBalancer.CacheOperationFacadevoidinit(Properties props) Deprecated.as of Geode 1.5 use initialize instead.voidinitialize(Cache cache, Properties props) Initializes a user-defined object, owned by the given cache, using the given properties.
-
Field Details
-
SCHEDULE
Use this configuration to manage out-of-balance audit frequency. If the auditor finds the system to be out-of-balance, it will trigger re-balancing. Any valid cron string is accepted. The sub-expressions represent the following:- Seconds
- Minutes
- Hours
- Day-of-Month
- Month
- Day-of-Week
- Year (optional field)
For. e.g.
0 0 * * * ?for auditing the system every hour- See Also:
-
SIZE_THRESHOLD_PERCENT
Use this configuration to manage re-balance invocation. Rebalance operation will be triggered if the total number of bytes rebalance operation may move is more than this threshold, in percentage of the total data size.Default value
DEFAULT_SIZE_THRESHOLD_PERCENT- See Also:
-
DEFAULT_SIZE_THRESHOLD_PERCENT
public static final int DEFAULT_SIZE_THRESHOLD_PERCENTDefault value ofSIZE_THRESHOLD_PERCENT. If 10% of data is misplaced, its a good time to redistribute buckets- See Also:
-
MINIMUM_SIZE
In the initial data load phases,SIZE_THRESHOLD_PERCENTbased rebalance invocation may be unnecessary. Rebalance should not be triggered if the total data size managed by cluster is too small. Rebalance operation will be triggered if the total number of bytes rebalance operation may move is more than this number of bytes.Default value
DEFAULT_MINIMUM_SIZE- See Also:
-
DEFAULT_MINIMUM_SIZE
public static final int DEFAULT_MINIMUM_SIZEDefault value ofMINIMUM_SIZE. In the initial data load phases,SIZE_THRESHOLD_PERCENTbased rebalance invocation may be unnecessary. Do not rebalance if the data to be moved is less than 100MB- See Also:
-
AUTO_BALANCER_LOCK_SERVICE_NAME
Name of the DistributedLockService thatAutoBalancerwill use to guard against concurrent maintenance activity- See Also:
-
AUTO_BALANCER_LOCK
-
-
Constructor Details
-
AutoBalancer
public AutoBalancer() -
AutoBalancer
public AutoBalancer(org.apache.geode.cache.util.AutoBalancer.AuditScheduler scheduler, org.apache.geode.cache.util.AutoBalancer.OOBAuditor auditor, org.apache.geode.cache.util.AutoBalancer.TimeProvider clock, org.apache.geode.cache.util.AutoBalancer.CacheOperationFacade cacheFacade)
-
-
Method Details
-
initialize
Description copied from interface:DeclarableInitializes a user-defined object, owned by the given cache, using the given properties. Note that any uncaught exception thrown by this method will cause theCacheinitialization to fail. Note that if this method is implemented then the deprecated init method should not be implemented. The product will call both methods assuming that only one will have a non-default implementation.- Specified by:
initializein interfaceDeclarable- Parameters:
cache- the cache that owns this declarableprops- Contains the parameters declared in the declarative xml file.
-
init
Deprecated.as of Geode 1.5 use initialize instead.Description copied from interface:DeclarableInitializes a user-defined object using the given properties. Note that any uncaught exception thrown by this method will cause theCacheinitialization to fail.- Specified by:
initin interfaceDeclarable- Parameters:
props- Contains the parameters declared in the declarative xml file.
-
getCacheOperationFacade
public org.apache.geode.cache.util.AutoBalancer.CacheOperationFacade getCacheOperationFacade() -
destroy
public void destroy()
-