Logo

安裝 google-perftools 增強 MySQL 的效能

MySQL 的效能向來是希望能越高越好,搜尋了一下除了調整 my.cnf 的參數之外還有沒有可以增強 MySQL 效能的方法時發現了 google-perftools 似乎就是一道曙光呀~! :O Fast, multi-threaded malloc() and nifty performance analysis tools,這不就是我要的嗎! 就在咕狗大神的指示,而且 Cアプリを高速化せよ! – 正式リリースされたgoogle-perftoolsを試す 這邊提到了降低了不少秒數,所以 query 當然是快的很,也所以偶裝好了~ 筆記下去! ?
下載並安裝 google-perftools (環境 OS是CentOS 5.4 X86_64 MySQL 5.1.40 )
☆☆☆ 64位元作業系統請先安裝 libunwind 再安裝 google-perftools ☆☆☆
wget http://ftp.cse.yzu.edu.tw/pub/Unix/gnu/nongnu/libunwind/libunwind-0.99.tar.gz
tar zxvf libunwind-0.99.tar.gz
rm -f libunwind-0.99.tar.gz
cd libunwind-0.99
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install
make
make install
cd ..

台灣以外載點用 wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz
黑與白的世界就從這開始了~ ?
wget http://google-perftools.googlecode.com/files/google-perftools-1.4.tar.gz
tar zxvf google-perftools-1.4.tar.gz
rm -f google-perftools-1.4.tar.gz
cd google-perftools-1.4
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
cd ..

啟動 TCMalloc
vi /usr/local/mysql/bin/mysqld_safe
找到第15行的
#executing mysqld_safe
在這行的下面加入這段
export LD_PRELOAD=/usr/local/lib/libtcmalloc.so
儲存後重新啟動 MySQL 再看看有沒有啟動
service mysql restart
尋找開啟的檔案來檢查 TCMalloc 有沒有啟動成功
lsof -n | grep tcmalloc
TCMalloc

附送好用的工作管理員 htop! ?
安裝時需要 ncurses 模組
yum -y install ncurses ncurses-devel
wget http://softlayer.dl.sourceforge.net/sourceforge/htop/htop-0.8.3.tar.gz
tar zxvf htop-0.8.3.tar.gz
rm -f htop-0.8.3.tar.gz
cd htop-0.8.3
./configure
make
make install

安裝完畢後下 htop 就啟動了,多個h而已 ?
HTOP

列印本文 列印本文

關於 窮苦人家的小孩

In every democracy, the people get the government they deserve. ~Alexis de Tocqueville
上一篇:
下一篇:

您可能會喜歡

有坂深雪 Miyuki Arisaka

[Debain]安裝HestiaCP

2021新年快樂 🌞㊗☃ 最近 …