BigMemory 4.3.10 | Product Documentation | BigMemory Go Configuration Guide | Configuring Fast Restart (FRS) | Configuration Examples
 
Configuration Examples
This section presents possible disk usage configurations for BigMemory Go.
Options for Crash Resilience
The following configuration provides fast restartability with fully consistent data persistence:
<ehcache>
<diskStore path="/path/to/store/data"/>
<cache>
<persistence strategy="localRestartable" synchronousWrites="true"/>
</cache>
</ehcache>
The following configuration provides fast restartability with eventually consistent data persistence:
<ehcache>
<diskStore path="/path/to/store/data"/>
<cache>
<persistence strategy="localRestartable" synchronousWrites="false"/>
</cache>
</ehcache>
Temporary Disk Storage
The "localTempSwap" persistence strategy create a local disk tier for in-memory data during BigMemory operation. The disk storage is temporary and is cleared after a restart.
<ehcache>
<diskStore path="/auto/default/path"/>
<cache>
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>
Note:
With the "localTempSwap" strategy, you can use maxEntriesLocalDisk or maxBytesLocalDisk at either the Cache or CacheManager level to control the size of the disk tier.
In-memory Only Cache
When the persistence strategy is "none", all cache stays in memory (with no overflow to disk nor persistence on disk).
<cache>
<persistence strategy="none"/>
</cache>
Programmatic Configuration Example
The following is an example of how to programmatically configure cache persistence on disk:
Configuration cacheManagerConfig = new Configuration()
.diskStore(new DiskStoreConfiguration()
.path("/path/to/store/data"));
CacheConfiguration cacheConfig = new CacheConfiguration()
.name("my-cache")
.maxBytesLocalHeap(16, MemoryUnit.MEGABYTES)
.maxBytesLocalOffHeap(256, MemoryUnit.MEGABYTES)
.persistence(new PersistenceConfiguration().strategy(Strategy.LOCALRESTARTABLE));
cacheManagerConfig.addCache(cacheConfig);
CacheManager cacheManager = new CacheManager(cacheManagerConfig);
Ehcache myCache = cacheManager.getEhcache("my-cache");