Monday, November 20, 2017

Oracle Linux - Redis & transparent hugepage settings

When deploying Redis on Oracle Linux you might run into a warning situation making a statement about transparent hugepage settings. The statement made by Redis is that Redis might have performance issues when working on a system that is configured to use transparent hugepages (THP). THP is an abstraction layer that automates most aspects of creating, managing, and using huge pages in your memory. If you want to be compliant with the best practices from Redis you will have to take notice if this warning level during startup.

In general the statement made by Redis is the following you will see:

Transparent huge pages must be disabled from your kernel. Use echo never > /sys/kernel/mm/transparent_hugepage/enabled to disable them, and restart your Redis process.

As you can see the statement also includes a clear message on how to resolve this. To be able to see if things go as expected you will have to understand how the content of this file is represented. In general you will have a number of values that are valid:

Transparent hugepages will always be used by Oracle Linux

Oracle Linux will ask advice from madvise for advice if transparent hugepages should be used or not. The madvise() system call is used to give advice or directions to the kernel about the address range beginning at address addr and with size length bytes In most cases, the goal of such advice is to improve system or application performance.

Transparent hugepages will never be used by Oracle Linux

If you check the file in question you will see that the choice made is represented by the value between brackets. In our case we have selected never and as you can see in the below example never is between brackets.

[root@localhost tmp]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@localhost tmp]# 

Understanding which value is active, in our case never, is vital for understanding the current setting in your system. Do note, this holds you might want to build a check which is just a bit more intelligent than doing a cat on the file.

No comments: