I and my team recently noticed that starting Redis on our VMs gives the following warning: "WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis.".

I investigated the topic a little bit just to find out that most DB vendors suggest (if not require) you to disable THP. Just a few examples:

I also noticed that many distros come with this feature enabled by default:

  • Red Hat
  • CentOS
  • Ubuntu
  • CoreOS

So the questions are:

  • why is it enabled by default?
  • what could be the downsides/risks of disabling THP on our cluster VMs (a Kubernetes cluster based on CoreOS where we run a lot of different Docker containers)?

The THP is a linux feature , it is enabled by default on some linux distro to increase the application performance. but it is not recommended by some os database vendors because it decrease the performance of theirs products .

From the Red-HAT docs (Why the THP is enabled):

As the goal of THP is improving performance, its developers (both from the community and Red Hat) have tested and optimized THP across a wide range of systems, configurations, applications, and workloads. This allows the default settings of THP to improve the performance of most system configurations. However, THP is not recommended for database workloads.

From: Oracle Docs (Why you should disable the THP ?)

but unfortunately Transparent HugePages don't play well with Oracle databases and are associated with node reboots in RAC installations and performance problems on both single instance and RAC installations. As a result Oracle recommends disabling Transparent HugePages on all servers running Oracle databases

what could be the downsides/risks of disabling THP on our cluster VMs?

Keeping THP enabled is a security feature to prevent the mmap flood attack.

Applications however can be further optimized to take advantage of this feature, like for example they've been optimized before to avoid a flood of mmap system calls for every malloc(4k). Optimizing userland is by far not mandatory and khugepaged already can take care of long lived page allocations even for hugepage unaware applications that deals with large amounts of memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.