Home >Database >Mysql Tutorial >ubuntu server下使用Google Performance Tools优化MySQL在高并

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

WBOY
WBOYOriginal
2016-06-07 16:39:541315browse

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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn