Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to turn off Transparent Huge Pages for redis

Tags:

redis

According to redis docs, it's advisable to disable Transparent Huge Pages.

Would the guidance be the same if the machine was shared between the redis server and the application.

Moreover, for other technologies, I've also read guidance that THP should be disabled for all production environments when setting up the server. Is this kind of pre-emptiveness applicable to redis as well, or one must first strictly monitor latency issues before deciding to turn off THP?

like image 915
Hassan Baig Avatar asked Mar 04 '17 02:03

Hassan Baig


People also ask

What is transparent huge pages in Redis?

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.

What is the difference between HugePages and transparent huge pages?

Transparent Hugepages are similar to standard HugePages. However, while standard HugePages allocate memory at startup, Transparent Hugepages memory uses the khugepaged thread in the kernel to allocate memory dynamically during runtime, using swappable HugePages.

What is transparent huge page compaction?

Transparent HugePage Support (THP) is an alternative mean of using huge pages for the backing of virtual memory with huge pages that supports the automatic promotion and demotion of page sizes and without the shortcomings of hugetlbfs. Currently THP only works for anonymous memory mappings and tmpfs/shmem.


1 Answers

Turn it off. The problem lies in how THP shifts memory around to try and keep or create contiguous pages. Some applications can tolerate this, most databases cannot and it causes intermittent performance problems, some pretty bad. This is not unique to Redis by any means.

For your application, especially if it is JAVA, set up real HugePages and leave the transparent variety out of it. If you do that just make sure you alocate memory correctly for the app and redis. Though I have to say, I probably would not recommend running both the app and redis on the same instance/server/vm.

like image 133
Kirk Avatar answered Oct 07 '22 23:10

Kirk