首页 >数据库 >mysql教程 >ubuntu server下使用Google Performance Tools优化MySQL在高并

ubuntu server下使用Google Performance Tools优化MySQL在高并

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-07 16:39:541322浏览

step 1. 因为是64位的系统,所以先要安装libunwind,32位系统可以忽略此步 wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gztar zxvf libunwind-1.1.tar.gzcd libunwind-1.1/CFLAGS=-fPIC ./configure --enable-sharedmake CF

step 1. 因为是64位的系统,所以先要安装libunwind,32位系统可以忽略此步

wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
tar zxvf libunwind-1.1.tar.gz
cd libunwind-1.1/
CFLAGS=-fPIC ./configure --enable-shared
make CFLAGS=-fPIC
make CFLAGS=-fPIC install

step 2.安装Google Performance Tools

wget https://gperftools.googlecode.com/files/gperftools-2.1.tar.gz
tar zxvf gperftools-2.1.tar.gz
cd gperftools-2.1/
./configure
make -j8
make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig

step 3. 修改MySQL启动脚本(根据你的MySQL安装位置而定):

vi /usr/local/mysql/bin/mysqld_safe

在# executing mysqld_safe的下一行,加上:

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

保存后退出,然后重启MySQL服务器。

step 4. 使用lsof命令查看tcmalloc是否起效:

lsof -n|grep tcmalloc

如果发现以下信息,就证明配置成功了。

mysqld    12278      mysql  mem       REG              202,1    2241773    1186797 /usr/local/lib/libtcmalloc.so.4.1.2
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn