Directadmin使用gperftools工具包TCMalloc优化MySQL

首先安装gperftools工具包,可以放心使用,因为很简单,他来自Google!包含了TCMalloc, heap-checker, heap-profiler 和 cpu-profiler
项目主页
该安装套提供了.tar.gz RPM deb 等多种格式的安装包,只支持linux

  1. #rpm -Uvh https://gperftools.googlecode.com/files/gperftools-devel-2.0-1.i386.rpm
  2. #或者下载tar.gz再手动编译
  3. [root@localhost ~]# wget -c http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz -O /root/downloads/gperftools-2.0.tar.gz #下载安装包
  4. [root@localhost ~]# cd ~/downloads/ #进入刚下载的文件夹
  5. [root@localhost ~]# tar zxf  gperftools-2.0.tar.gz #解压缩
  6. [root@localhost ~]# cd gperftools-2.0/ #进入
  7. [root@localhost ~]# ./configure ; make ; make install #并编译安装
  8. [root@localhost ~]# echo '/usr/local/lib' >> /etc/ld.so.conf.d/usr_local_lib.conf
  9. [root@localhost ~]# ldconfig -v #重新读取新的动态链接库文件
  10. [root@localhost ~]# sed -i '/bin\/bash/a\export LD_PRELOAD=/usr/local/lib/libtcmalloc.so' /usr/bin/mysqld_safe #修改这个文件
  11. [root@localhost ~]# service mysqld restart #重启MySQL服务
  12.  
  13. #经过测试,MySQL并发在100左右,负载高达60-70,MySQL表现良好,不愧为Google出品!
1 1