Use TCMalloc to Improve MySQL Service

Someone recommended this article to me: http://www.javayou.com/diary/18368. TCMalloc is explained here TCMalloc : Thread-Caching Malloc, and you can download libunwind from The libunwind project.

Then do the following to install:

#tar zxvf libunwind-0.98.6.tar.gz
#cd libunwind-0.98.6
#./configure
#make
#make install

#tar zxvf google-perftools-0.94.1.tar.gz
#cd google*
#./configure
#make
#make install

Then open the file mysqld_safe (/usr/bin/mysqld_safe) and add
LD_PRELOAD="/usr/local/lib/libtcmalloc.so"

#service mysql restart

Comments

export and _minimal

export LD_PRELOAD="/usr/local/lib/libtcmalloc_minimal.so"

I had to have the export in front, and using _minimal.so gained me about 10%(sysbench readonly).