1. download MySQL source package, compile and install (slightly)
2. Download and install Google-perftools
wget Https://lnamp-web-server.googlecode.com/files/google-perftools-1.7.tar.gzwget http://ftp.twaren.net/Unix/ Nongnu//libunwind/libunwind-0.99.tar.gz
3. - -bit systems need to install the Libunwind package
Tar zxvf libunwind-0.99.tar.gzcd libunwind-0.99cflags=-fpic./configure--enable-sharedmake CFLAGS=-fPICmake CFLAGS=- FPIC Install
4. Installing the Google-perftools package
Tar zxvf google-perftools-1.7.tar.gzcd google-perftools-1.7mkdir/work/tc./configure--PREFIX=/WORK/TC-- Disable-cpu-profiler--disable-heap-profiler--disable-heap-checker--disable-debugalloc--enable-minimalmake & & Make Install
5. Copy the dynamic link library to the system directory
Cp/work/tc/lib/libtcmalloc_minimal.so.0.1.0/usr/local/libln-s/usr/local/lib/libtcmalloc_minimal.so.0.1.0/usr/ Local/lib/libtcmalloc.soln-s/usr/local/lib/libtcmalloc_minimal.so.0.1.0/usr/local/lib/libtcmalloc.so.0ln-s/usr /local/lib/libtcmalloc_minimal.so.0.1.0/usr/local/lib/libtcmalloc.so.0.1.0
6. adjusting the Mysqld_safe configuration file
Vim/work/mysql5.5/bin/mysqld_safe
After this line of files, add the following:
# executing Mysqld_safe exportld_preload= "/usr/local/lib/libtcmalloc.so"
7. Restart MySQL
/etc/init.d/mysql restart
8. validation
[Email protected] ~]# Lsof-n | Greptcmallocmysqld 17895 mysql mem REG 253,0 962769 534587/usr/local/lib/libtcmalloc_min Imal.so.0.1.0[[email protected] ~]#
This article is from the "Sword Slave" blog, be sure to keep this source http://diudiu.blog.51cto.com/6371183/1581234
Use Google's tcmalloc to accelerate MySQL