Product Documentation : Ehcache Configuration Guide : Sizing Storage Tiers : Pooling Resources Versus Sizing Individual Caches
Pooling Resources Versus Sizing Individual Caches
You can constrain the size of any cache on a specific tier in that cache's configuration. You can also constrain the size of all of a CacheManager's caches in a specific tier by configuring an overall size at the CacheManager level.
If there is no CacheManager-level pool specified for a tier, an individual cache claims the amount of that tier specified in its configuration. If there is a CacheManager-level pool specified for a tier, an individual cache claims that amount from the pool. In this case, caches with no size configuration for that tier receive an equal share of the remainder of the pool (after caches with explicit sizing configuration have claimed their portion).
For example, if CacheManager with eight caches pools one gigabyte of heap, and two caches each explicitly specify 200MB of heap while the remaining caches do not specify a size, the remaining caches will share 600MB of heap equally. Note that caches must use bytes-based attributes to claim a portion of a pool; entries-based attributes such as maxEntriesLocal cannot be used with a pool.
On startup, the sizes specified by caches are checked to ensure that any CacheManager-level pools are not over-allocated. If over-allocation occurs for any pool, an InvalidConfigurationException is thrown. Note that percentages should not add up to more than 100% of a single pool.
If the sizes specified by caches for any tier take exactly the entire CacheManager-level pool specified for that tier, a warning is logged. In this case, caches that do not specify a size for that tier cannot use the tier as nothing is left over.
Memory Store (Heap)
A size must be provided for the heap, either in the CacheManager (maxBytesLocalHeap only) or in each individual cache (maxBytesLocalHeap or maxEntriesLocalHeap). Not doing so causes an InvalidConfigurationException.
If a pool is configured, it can be combined with a heap setting in an individual cache. This allows the cache to claim a specified portion of the heap setting configured in the pool. However, in this case the cache setting must use maxBytesLocalHeap (same as the CacheManager).
In any case, every cache must have a heap setting, either configured explicitly or taken from the pool configured in the CacheManager.
Local Disk Store
The local disk can be used as a data tier, either for temporary storage or for disk persistence, but not both at once.
To use the disk as a temporary tier during BigMemory operation, set the persistenceStrategy to "localTempSwap", and use the maxBytesLocalDisk setting to configure the size of this tier. For more information about using the disk as a temporary tier, see Configuring Disk Store.
For information about using the disk store for data persistence, see Cache Persistence Implementation.
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback