Considerations for Configuring BigMemoryCache
When you create a cache that uses BigMemory, keep the following points in mind:
A
BigMemory cache accepts only serializable keys and values. If a service attempts to put a non-serializable object into the cache at run time, the service will receive an exception.
Allocate at least 100 elements to the on-heap portion of cache. Smaller on-heap cache sizes do not perform efficiently.
Integration Server will log a warning message if a
BigMemory cache is initialized with fewer than 100 elements allocated to the on-heap portion of the cache.
Allocate at least 128 megabytes to the off-heap portion of the cache.
Be aware that not all of the direct memory that you allocate to the JVM is available for off-heap caches. You must reserve 32 megabytes for non-cache use by
BigMemory. (In other words, the amount of memory available for off-heap caching is
MaxDirectMemorySize minus 32M.)
Before you specify the off-heap memory for the new cache, check how much
BigMemory is already allocated by off-heap caches that exist on the
Integration Server. The off-heap memory that you specify for this cache must fit within whatever direct memory remains (minus the 32 megabytes of that memory is reserved for non-cache use, as mentioned above).
To determine how much BigMemory is already used by existing caches, examine the BigMemory column on the Settings > Caching > CacheManagerName page for each cache manager.
Integration Server allocates the off-heap portion of a cache (the amount of memory specified in the
Maximum Off-Heap) when it instantiates the cache. If it cannot obtain the amount of memory specified in
Maximum Off-Heap, the
Integration Server writes an error message to the server log, places a stack trace in the error log, and does not enable the cache.
The off-heap memory that you allocate to a cache actually includes a copy of the elements that reside in on-heap cache. Keep this point in mind when you specify the
Maximum Off-Heap parameter for the cache. For example, if you set
Maximum Off-Heap to 128 MB and your elements are approximately 1 KB each, your cache will be able to hold about 128,000 elements in off-heap memory. However, this number includes copies of the on-heap elements. If the size of your on-heap cache is 2,000 elements, then the off-heap cache will hold copies of those 2,000 elements, plus 126,000 additional elements.
If you enable the
Overflow to Disk option and you want to limit the number of elements that can be written to disk using the
Maximum Entries Local Disk parameter, set
Maximum Entries Local Disk to a value that is greater than the number of elements that the amount of memory in
Maximum Off-Heap can hold. For example, if
Maximum Off-Heap will hold about 128,000 elements and you want to allow an additional 50,000 elements to overflow to disk, set
Maximum Entries Local Disk to 178,000 elements.