This post discusses enabling and disabling jemalloc on Percona Server for MySQL.
The benefits of jemalloc versus glibc for use with MySQL have been widely discussed. With jemalloc (along with Transparent Huge Pages disabled) you have less memory fragmentation, and thus more efficient resource management of the available server memory.
For standard installations of Percona Server 5.6+ (releases starting with 5.6.19-67.0), the only thing needed to use jemalloc as the memory library for mysqld is for it to be installed on the server.
Enabling Jemalloc on Percona ServerFirst thing first: install Jemalloc.
The library is available on the Percona repository, which is available for both apt and yum package management:
Once you have the repo, just run the install command (according to your OS) to install it:
yum install jemalloc / apt-get install <b>libjemalloc1</b>
Now that you have the jemalloc package installed, all it takes to start using it is…..
That’s it! No modifications needed on the my.cnf file or anywhere else. Plain and simple!
Disabling Jemalloc on Percona ServerIf for any reason you need to disable jemalloc and go back to the default library, you have two options: remove the jemalloc package (not too practical), or add the following line to the [mysqld_safe] section of the my.cnf file:
In other words, an empty path. That will do the trick. Note that commenting or removing the “malloc-lib” parameter on the cnf file won’t work.
How to Know if Jemalloc is Being Used?There are couple of ways you can verify this, but the less invasive way is by using the pt-mysql-summary (version 2.2.20 and higher) tool from the Percona Toolkit:
root@reports:~# pt-mysql-summary | grep -A5 -i "memory management"
# Memory management library ##################################
jemalloc enabled in MySQL config for process with ID 5122
Using jemalloc from /usr/lib/x86_64-linux-gnu/libjemalloc.so.1
# The End ####################################################
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4