Linux kernel new feature called Transparent Huge Pages (THP) which is by default enabled on CentOS 6.x and above OS. Is THP good for MySQL DB machine?

I am trying following to disabled THP but seems not working

$sudo echo never > /sys/kernel/mm/transparent_hugepage/enabled
$sudo cat /sys/kernel/mm/transparent_hugepage/enabled 
always madvise [never]

Why still showing?

$sudo grep -i AnonHugePages /proc/meminfo
AnonHugePages:    176128 kB


$uname -r
  • In general huge pages are a good thing for any kind of database server. – Bratchley Apr 17 '15 at 2:20
  • I heard from various sources, just disable it because it create high load on CPU especially DB server. – Satish Apr 17 '15 at 2:23
  • No, I have no idea why someone would say that. Huge pages are intended to prevent swapping from disk so if anything it lowers CPU utilization for sequential memory access which is common. The down side is that it can waste memory space. I think Oracle has a problem with THP specifically and prefer you just allocate them statically. Still huge pages are usually a good thing. – Bratchley Apr 17 '15 at 2:29
  • 1
    I suggest forget THP and focus on tuning mysql itself, it has alot of options that can improve performance dramaticaly. – Baazigar Apr 17 '15 at 14:43
  • 1
    It's good for everyone to remember that huge pages and transparent huge pages are not the same issue. Yes, huge pages are good for databases when they're designed to use them. Transparent huge pages make normal memory access into huge page memory access which can cause excessive I/O for a database that was expecting to use regular sized pages. In general for a dedicated database server, leave huge pages settings and disable just the transparent huge pages. – karmakaze Sep 2 '18 at 0:05

Your Answer

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

Browse other questions tagged or ask your own question.