使用TCMalloc 优化MySQL

使用TCMalloc 优化MySQL
http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz

http://gperftools.googlecode.com/files/gperftools-2.1.tar.gz

参照MySQL管理之道 19页进行安装
tar -xf libunwind-1.1.tar.gz
cd libunwind-1.1
CFLAGS=-fPIC ./configure --enable-shared
make CFLAGS=-fPIC
make CFLAGS=-fPIC install

tar -xf gperftools-2.1.tar.gz
cd gperftools-2.1
./configure
make
make install

ls -l /usr/local/lib/libtcmalloc.so
ls -l /usr/local/lib/libunwind.so

将/usr/local/lib >>/etc/ld.so.conf
ldconfig
这个步骤很重要 第一次启动MySQL就报错了
修改
vim /usr/local/mysql/bin/mysqld_safe
# executing mysqld_safe 在此句下面添加如下内容
export LD_PRELOAD=/usr/local/lib/libtcmalloc.so

然后启动MySQL:
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf &

确认MySQL是否生效
[root@localhost ~]# lsof -n |grep tcmalloc
mysqld    21167  mysql  mem       REG                8,3    1951006    3358698 /usr/local/lib/libtcmalloc.so.4.1.2
[root@localhost ~]# lsof |grep -i libtcmalloc.so
mysqld    21167  mysql  mem       REG                8,3    1951006    3358698 /usr/local/lib/libtcmalloc.so.4.1.2


寻找Linux IP冲突情况
arp-scan -I eth0 -l


你可能感兴趣的:(mysql)