1. Install the libunwind library.
CD/usr/local
Wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
Tar xf libunwind-1.1.tar.gz CD libunwind-1.1
Cflags =-FPIC./configure # Add the compilation parameter make cflags =-FPIC install
Ii. Install gpperftools:
CD/usr/local
Download https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz with thunder
Then upload the file to/usr/local, because it seems that wget cannot download the HTTPS stuff, or it is very troublesome.
Tar-zxvf gperftools-2.0.tar.gz CD gperftools-2.0
./Configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
Iii. Adding MySQL to dynamic Databases
vi /usr/local/mysql/bin/mysqld_safe
Add the following line after "# executing mysqld_safe:
export LD_PRELOAD="/usr/local/lib/libtcmalloc.so"
The purpose is to load the tcmalloc dynamic library before starting MySQL.
4. Restart the MySQL service: Service MySQL restart 5. Verify that tcmalloc uses lsof to check whether the MySQL process has loaded the tcmalloc Library: "# lsof-N | grep tcmalloc
Reference:
Http://www.cnblogs.com/minglog/archive/2011/05/11/2043342.html
Further test:
Module pressure to test the memory usage and evaluate the execution efficiency.