BigMemory Go 4.3.5 | Code Samples | Example: Automatic Resource Control
 
Example: Automatic Resource Control
Note: The following description focuses on code snippets from the full code example, which is available at the /code-samples/src/ location in the installed product kit.
Automatic Resource Control (ARC) is a powerful capability of BigMemory Go that gives you the ability to control how much data is stored in heap memory and off-heap memory.
The following XML configuration instructs ARC to allocate a maximum of 512 M of heap memory and 32 G of off-heap memory. In this example, when 512 M of heap memory is used, ARC will automatically move data into off-heap memory up to a maximum of 32 G. The amount of off-heap memory you can use is limited only by the amount of physical RAM you have available.
<ehcache xmlns:xsi="http://www.w3.o r g/2001/XML Schema-instance"
     xsi:no NamespaceSc he maLocation="http://ehcache.org/ehcache.xsd"
     updateCheck="false" monitoring="autodetect"
     dynamicConfig="true"
     name="MyManager" maxBytesLocalHeap="512M"
     maxBytesLocalOffHeap="32G">

  <defaultCache>
  </defaultCache>
  <cache name="BigMemory1">
  </cache>
  <cache name="BigMemory2">
  </cache>
 
</ehcache>
It's also possible to allocate resources on a per-data set basis. Here is an example of allocating 8 GB of off-heap memory to the BigMemory1 data set and 24 GB of off-heap memory to the BigMemory2 data set:
<ehcache xmlns
...
name="MyManager"
maxBytesLocalHeap="512M"
maxBytesLocalOffHeap="32G"
maxBytesLocalDisk="128G">
<cache name="BigMemory1"
maxBytesLocalOffHeap="8G">
</cache>
<cache name="BigMemory2"
maxBytesLocalOffHeap="24G">
</cache>
</ehcache>

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release