Locking Memory (Linux Systems Only)
On Linux systems, you can lock memory to prevent the operating system from paging out heap or off-heap memory.
To use this feature:
Configure the operating system limits for locked memory. Increase the operating system’s
ulimit -lvalue (the maximum size that may be locked in memory) from the default (typically 32 KB or 64 KB) to at least the total amount of memory used by GemFire for on-heap or off-heap storage. To view the current setting, enter
ulimit -aat a shell prompt and find the value for
max locked memory:
# ulimit -a ... max locked memory (kbytes, -l) 64 ...
ulimit -l max-size-in-kbytesto raise the limit. For example, to set the locked memory limit to 64 GB:
# ulimit -l 64000000
Using locked memory in this manner increases the time required to start GemFire. The additional time required to start GemFire depends on the total amount of memory used, and can range from several seconds to 10 minutes or more. To improve startup time and reduce the potential of member timeouts, instruct the kernel to free operating system page caches just before starting a GemFire member by issuing the following command:
$ echo 1 > /proc/sys/vm/drop_caches
Start each GemFire data store with the gfsh
-lock-memory=trueoption. If you deploy more than one server per host, begin by starting each server sequentially. Starting servers sequentially avoids a race condition in the operating system that can cause failures (even machine crashes) if you accidentally over-allocate the available RAM. After you verify that the system configuration is stable, you can then start servers concurrently.