Because VoltDB is an in-memory database, proper memory management is vital to the effective operation of VoltDB databases. Three important aspects of memory management are:
Memory Mapping (Transparent Huge Pages)
The following sections explain how best to configure these features for optimal performance of VoltDB.
Swapping is an operating system feature that optimizes memory usage when running multiple processes by swapping processes in and out of memory. However, any contention for memory, including swapping, will have a very negative impact on VoltDB performance and functionality. You should disable swapping when using VoltDB.
To disable swapping on Linux systems, use the
swapoff command. If swapping cannot be disabled for
any reason, you can reduce the likelihood of VoltDB being swapped out by setting the kernel parameter
vm.swappiness to zero.
Transparent Huge Pages (THP) are another operating system feature that optimizes memory usage for systems with large amounts of memory. THP changes the memory mapping to use larger physical pages. This can be helpful for general-purpose computing running multiple processes. However, for memory-intensive applications such as VoltDB, THP can actually negatively impact performance.
Therefore, it is important to disable Transparent Huge Pages on servers running VoltDB. The following commands disable THP:
$ echo never >/sys/kernel/mm/transparent_hugepage/enabled
$ echo madvise >/sys/kernel/mm/transparent_hugepage/enabled
For RHEL systems (including CentOS), replace "transparent_hugepage" with "redhat_transparent_hugepage".
Note, however, that these commands disable THP only while the server is running. Once the server reboots, the default setting will return. Therefore, we recommend you disable THP permanently as part of the startup process. For example, you can add the following commands to a server startup script (such as /etc/rc.local):
#!/bin/bash for f in /sys/kernel/mm/*transparent_hugepage/enabled; do if test -f $f; then echo never > $f; fi done for f in /sys/kernel/mm/*transparent_hugepage/defrag; do if test -f $f; then echo never > $f; fi done
THP are not enabled by default in Ubuntu prior to release 14.04 or RHEL 5.x. But they are enabled by default for recent Ubuntu releases and RHEL 6.x. To see if they are enabled on your current system, use either of the following pair of commands:
$ cat /sys/kernel/mm/transparent_hugepage/enabled $ cat /sys/kernel/mm/transparent_hugepage/defrag $ cat /sys/kernel/mm/redhat_transparent_hugepage/enabled $ cat /sys/kernel/mm/redhat_transparent_hugepage/defrag
If THP is disabled, the output from the preceding commands should be either “always madvise [never]” or “always [madvise] never”.
Although swapping is bad for memory-intensive applications like VoltDB, the server does make use of virtual memory
(VM) and there are settings that can help VoltDB make effective use of that memory. First, it is a good idea to enable VM
overcommit. This avoids VoltDB encountering unnecessary limits when managing virtual memory. This is done on Linux by
setting the system parameter
vm.overcommit_memory to a value of "1".
$ sysctl -w vm.overcommit_memory=1
Second, for large memory systems, it is also a good idea to increase the VM memory mapping limit. So for servers
with 64 Gigabytes or more of memory, the recommendation is to increase VM memory map count to 1048576. You do this on
Linux with the system parameter
max_map_count. For example:
$ sysctl -w vm.max_map_count=1048576
Remember that for both overcommit and the memory map count, the parameters are only active while the system is
running and will be reset to the default on reboot. So be sure to add your new settings to the file
/etc/sysctl.conf to ensure they are in effect when the system is restarted.