Disabling Transparent Huge Pages (THP)

Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of Translation Lookaside Buffer (TLB) lookups on machines with large amounts of memory by using larger memory pages.

However, database workloads often perform poorly with THP, because they tend to have sparse rather than contiguous memory access patterns. Linux THP must be disabled on all server running NuoDB process pods. To ensure correct performance, NuoDB will not run on a Linux machine with THP enabled.

Determining Whether THP is Enabled

To determine whether THP is enabled on a system, run the following command:

$ cat /sys/kernel/mm/transparent_hugepage/enabled

If the content of the file is always madvise never or always madvise never, THP is already disabled. If the content is [always] madvise never, THP is enabled and you must disable it to run NuoDB.

Disabling THP

For systems with tuned enforcing profiles, a NuoDB profile is provided along with its associated installer. For those systems using systemd, an init script is provided, along with its associated installer.

On each host running NuoDB in your cluster, run the associated install.sh script.

The script installs a tuned profile that follows:

[main]
summary=Optimize for NuoDB Distributed RDBMS
include=openshift-node
[vm]
transparent_hugepages=never	

Note: After script has been run to disable THP, a restart of Tuned is required which takes at most one second. If necessary, schedule an appropriate time to perform the restart.

Note: THP must be disabled at node level; disabling THP on a node disables THP for every pod running on that node.

For more information on performance tuning, see Performance tuning with tuned-adm.

For more information on tuned-adm, see the Tuned-Adm Guide.

For more information on tuned built-in profiles, see Tuned Daemon GitHub Project.