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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:39:54
Original
1322 people have browsed it

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
Copy after login

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
Copy after login

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

vi /usr/local/mysql/bin/mysqld_safe
Copy after login

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

export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
Copy after login

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

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

lsof -n|grep tcmalloc
Copy after login

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

mysqld    12278      mysql  mem       REG              202,1    2241773    1186797 /usr/local/lib/libtcmalloc.so.4.1.2
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template