现在的位置: 首页 > 综合 > 正文

16、单机运行环境搭建之 --CentOS-6.4下使用TCMalloc优化mysql5.6

2012年10月03日 ⁄ 综合 ⁄ 共 845字 ⁄ 字号 评论关闭

一、安装libunwind库。

复制代码
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  #添加编译参数 make CFLAGS=-fPIC make CFLAGS=-fPIC install
复制代码

二、 安装gpperftools:

复制代码
cd /usr/local

用迅雷下载 https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
然后上传到 /usr/local,因为好像wget 下载https的东东是不行的,或者很麻烦。
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
复制代码
 

三、 Mysql加入动态库

vi /usr/local/mysql/bin/mysqld_safe

在“# executing mysqld_safe”行后添加行:

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

目的是在启动mysql前, 加载tcmalloc动态库。

四、重启Mysql服务:

service mysql restart
 
 

五、验证TCMalloc

使用lsof查看mysql进 程是否已经加载了tcmalloc库:"
#  lsof -n | grep tcmalloc

 

参考文档:

http://www.cnblogs.com/minglog/archive/2011/05/11/2043342.html

进一步测试:

模块压力进行内存占用测试,并评估执行效率。

抱歉!评论已关闭.