Created
September 25, 2011 10:21
-
-
Save dspezia/1240452 to your computer and use it in GitHub Desktop.
Compiling Redis against libhugetlbfs to activate huge pages support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Redis can be compiled against libhugetlbfs, so huge pages support can be activated with Linux >= 2.6.16. | |
It should cover Enterprise Linux distros such as SLES 10 or better, and RHEL/Centos/OEL 5 or better. | |
Be sure to read http://lwn.net/Articles/374424/ first. | |
Install libhugetlbfs source code in local directory $DIRHUGE | |
Source can be downloaded from http://libhugetlbfs.sourceforge.net/ | |
Compile only the 64 bits version using make BUILDTYPE=NATIVEONLY | |
The library will be generated in $DIRHUGE/obj64 - add it in your LD_LIBRARY_PATH | |
Setup your huge page configuration (root access needed) | |
sudo sysctl -w vm.nr_hugepages=<N> | |
sudo mount -t hugetlbfs none /mnt/hugetlbfs | |
To compile Redis against libhugetlbfs, you need to build Redis against libc memory allocator. | |
Note that in 2.4 it is not anymore the default. | |
Alter the Redis makefile as follows: | |
27c27 | |
< CCLINK?= -lm -pthread -L $(DIRHUGE)/obj64 -l hugetlbfs | |
--- | |
> CCLINK?= -lm -pthread | |
Build Redis | |
To activate automatic usage of huge pages, the following variables should be declared | |
in Redis environment: | |
export LD_LIBRARY_PATH=$(DIRHUGE)/obj64:$LD_LIBRARY_PATH | |
export HUGETLB_MORECORE=yes | |
Then launch Redis as usual. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment