Installing BigMemory Go
Installing BigMemory Go is as easy as downloading the kit and ensuring that the correct files are on your application's classpath. The only platform requirement is using JDK 1.6 or higher.
To install BigMemory Go
The kit is packaged as a tar.gz file. Unpack it on the command line or with the appropriate decompression application.
Note:
When installing the kit, it may be possible to use special characters in the install path, such as ...
`!@#$%^&*()+={}[]|;"'<>?,/.
Avoid such characters to keep the installed product in paths that allow for support and fixes.
2. The following JARs are found in the kit's lib directory and must be added to your application's classpath:
ehcache-ee-<version>.jar This file contains the API to BigMemory Go.
slf4j-api-<version>.jar This file is the bridge, or logging facade, to the BigMemory Go logging framework.
3. Save the BigMemory Go license-key file to the BigMemory Go home directory. This file, called terracotta-license.key, was attached to an email you received after registering for the BigMemory Go download.
Alternatively, you can add the license key file to your application's classpath, or explicitly specify the location of the license file as described in
Working with Terracotta License Files.
4. BigMemory Go uses Ehcache as its user-facing interface. To configure BigMemory Go, create or update an Ehcache configuration file to specify how much off-heap in-memory storage your want to use. You may also configure BigMemory to write data to a local disk store for fast restart. For example:
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
name="myBigMemoryGoConfig">
<!-- Tell BigMemory where to write its data to disk. -->
<diskStore path="/path/to/my/disk/store/directory"/>
<!-- set "maxBytesLocalOffHeap" to the amount of off-heap memory you
want to use. This memory is invisible to the Java garbage collector,
providing gigabytes to terabytes of in-memory data without garbage
collection pauses. -->
<cache name="myBigMemoryGoStore"
maxBytesLocalHeap="512M"
maxBytesLocalOffHeap="32G">
<!-- Tell BigMemory to use the "localRestartable" persistence
strategy for fast restart (optional). -->
<persistence strategy="localRestartable"/>
</cache>
</ehcache>
Set maxBytesLocalOffHeap to the amount of off-heap storage you want to use. Depending on your data and how much physical RAM you have available, you can use just a few gigabytes to multiple terabytes of off-heap memory in a single JVM for ultra-fast access with no garbage collection.
Name this configuration file ehcache.xml and place it in the top-level of your classpath.
For more information on configuration options, see the BigMemory Go Configuration Guide and to the reference ehcache.xml configuration file in the config-samples directory of the BigMemory Go kit.
5. Use the -XX:MaxDirectMemorySize Java option to allocate enough direct memory in the JVM to accomodate the off-heap storage specified in your configuration, plus at least 250MB to allow for other direct memory usage that might occur in your application. For example:
-Dcom.tc.productkey.path=/path/to/terracotta-license.key
Set MaxDirectMemorySize to the amount of BigMemory you have. For more information about this step, see "Allocating Direct Memory in the JVM in the BigMemory Go Configuration Guide.
Also, allocate at least enough heap using the -Xmx Java option to accommodate the on-heap storage specified in your configuration, plus enough extra heap to run the rest of your application. For example:
Xmx1g
6. Refer to the in the download kit for examples of how to employ the various features and capabilities of BigMemory Go. For information about the code samples, see About the BigMemory Go Code Samples in the online documentation for BigMemory Go.