VMware GemFire Java API Reference
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 java.lang.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.AutoBalancermonitors 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
ConfigInitializationimplementation. By default auto-balancing is disabled. A user needs to configureAutoBalancerduring cache initializationGemFireCache.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.
AutoBalancercan be controlled using the following configurationsSCHEDULE- TBD THRESHOLDS
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ObjectAUTO_BALANCER_LOCKstatic java.lang.StringAUTO_BALANCER_LOCK_SERVICE_NAMEName of the DistributedLockService thatAutoBalancerwill use to guard against concurrent maintenance activitystatic intDEFAULT_MINIMUM_SIZEDefault value ofMINIMUM_SIZE.static intDEFAULT_SIZE_THRESHOLD_PERCENTDefault value ofSIZE_THRESHOLD_PERCENT.static java.lang.StringMINIMUM_SIZEIn the initial data load phases,SIZE_THRESHOLD_PERCENTbased rebalance invocation may be unnecessary.static java.lang.StringSCHEDULEUse this configuration to manage out-of-balance audit frequency.static java.lang.StringSIZE_THRESHOLD_PERCENTUse this configuration to manage re-balance invocation.
-
Constructor Summary
Constructors Constructor Description AutoBalancer()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 Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddestroy()org.apache.geode.cache.util.AutoBalancer.CacheOperationFacadegetCacheOperationFacade()voidinit(java.util.Properties props)Deprecated.as of Geode 1.5 use initialize instead.voidinitialize(Cache cache, java.util.Properties props)Initializes a user-defined object, owned by the given cache, using the given properties.
-
-
-
Field Detail
-
SCHEDULE
public static final java.lang.String 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:
- Constant Field Values
-
SIZE_THRESHOLD_PERCENT
public static final java.lang.String 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:
- Constant Field Values
-
DEFAULT_SIZE_THRESHOLD_PERCENT
public static final int DEFAULT_SIZE_THRESHOLD_PERCENT
Default value ofSIZE_THRESHOLD_PERCENT. If 10% of data is misplaced, its a good time to redistribute buckets- See Also:
- Constant Field Values
-
MINIMUM_SIZE
public static final java.lang.String 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:
- Constant Field Values
-
DEFAULT_MINIMUM_SIZE
public static final int DEFAULT_MINIMUM_SIZE
Default 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:
- Constant Field Values
-
AUTO_BALANCER_LOCK_SERVICE_NAME
public static final java.lang.String AUTO_BALANCER_LOCK_SERVICE_NAME
Name of the DistributedLockService thatAutoBalancerwill use to guard against concurrent maintenance activity- See Also:
- Constant Field Values
-
AUTO_BALANCER_LOCK
public static final java.lang.Object AUTO_BALANCER_LOCK
-
-
Constructor Detail
-
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 Detail
-
initialize
public void initialize(Cache cache, java.util.Properties props)
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.Note that this method is only called when a Cache is created using gfsh cluster configuration or a declarative XML file. It will not be called when a Cache is created without XML using the Java APIs directly.
- Specified by:
initializein interfaceDeclarable- Parameters:
cache- the cache that owns this declarableprops- Contains the parameters declared in the declarative xml file.
-
init
@Deprecated public void init(java.util.Properties props)
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()
-
-