This tcmalloc is very famous, is the memory management module of Google, more reasonable than the traditional module control, can cope with higher concurrency, but also more stable.
However, this module is not the system comes with, there is no native installation, so you need to manually install the operation, a little bit of trouble. This module is included in the Google Package toolset Google-perftools.
Installation
Install the relevant runtime first, because it is written in C + +, need make, and a running environment libunwind
Yum-y install gcc make gcc-c++ libunwind
Then download and install Google-perftools
#下载源码包wget https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz# Unzip the source package tar XF gperftools-2.5.tar.gz# to start compiling the installation./confighremakemake install# Search, find the relevant C library files installed found/-name LIBTCMALLOC.SO/USR /local/lib/libtcmalloc.so/opt/gperftools-2.5/.libs/libtcmalloc.so# Create a Lib library soft connection so that you do not need to use Ldconfig ln-sf/usr/local/ lib/*/usr/lib/#完成ll/usr/lib/libtcmalloc.solrwxrwxrwx. 1 root root, Jan 12:05/usr/lib/libtcmalloc.so-/usr/local/lib/libtcmalloc.so
Installation is complete, just wait for the program to call, understand the development can test, I here directly with MySQL call.
===============================================
Because this software is a little hard to find, this link does not know when the failure, I uploaded 51cto downloaded
http://down.51cto.com/data/2437899
===============================================
Configure MySQL Usage
Using MySQL to call this module, there are two ways, one is to load to mysqld_safe boot, and the other is to load the configuration file. However, it is necessary to restart the MySQL program to take effect, as well as other programs.
If no item is loaded, the following command is not returned
Lsof-n | grep tcmalloc
Then, add the configuration file to MySQL my.cnf
#打开mysql配置文件, add the following two lines of VIM/USR/LOCAL/MYSQL/MY.CNF. . . [Mysqld_safe]malloc-lib=tcmalloc. . . #重启mysql/etc/init.d/mysql Restart
Note: If it is normal to install and load libtcmalloc.so, it will not be an error, the restart is directly effective. If there is an error, you need to study what went wrong, or try to reinstall it.
Now look at the use of No
lsof -n | grep tcmallocmysqld 3665 mysql mem REG 253,0 1050408 100663894 /usr/local/lib/libtcmalloc_minimal.so.4.3.0mysqld 3665 3666 mysql mem REG 253,0 1050408 100663894 /usr/local/lib/libtcmalloc_minimal.so.4.3.0mysqld 3665 3669 mysql mem reg 253,0 1050408 100663894 /usr/local/lib/libtcmalloc_minimal.so.4.3.0
You can clearly see that MySQL has loaded this module, then it can be used
Install the Tcmalloc Memory control module and configure MySQL to use