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新年快樂 🌞㊗☃ 最近 …

5 留言

  1. find 找的比較詳細,至於傷硬碟…,find指令是地毯式的搜索讀取硬碟是比較多沒錯,不過也沒那摸操硬碟吧~ 就跟在Windows上面用搜尋一樣意思啊! 而且VPS上的硬碟壞掉也不關你的事,是主機商的事,不用擔心這個吧。 ? 要快的話用locate mysqld_safe也很快。


    779:


    窮苦人家的小孩:

    查看看你的MySQL裝在哪?
    find / -name mysqld_safe

    真要命 想裝這個
    可是我在
    vi /usr/local/mysql/bin/mysqld_safe
    這一步死掉了 我在找不到local 下面找不到mysql

    我是去看鳥哥那邊 用whereis找的

    聽說find很傷HDD??


  2. 窮苦人家的小孩:

    查看看你的MySQL裝在哪?
    find / -name mysqld_safe

    真要命 想裝這個
    可是我在
    vi /usr/local/mysql/bin/mysqld_safe
    這一步死掉了 我在找不到local 下面找不到mysql

    我是去看鳥哥那邊 用whereis找的
    聽說find很傷HDD??

  3. 呼 裝完了
    我的SQL裝到別地方 去了冏 找好久
    /usr/bin/mysqld_safe
    來試試看論壇有沒有飛起來

  4. 查看看你的MySQL裝在哪?
    find / -name mysqld_safe

    真要命 想裝這個
    可是我在
    vi /usr/local/mysql/bin/mysqld_safe
    這一步死掉了 我在找不到local 下面找不到mysql

  5. 真要命 想裝這個
    可是我在
    vi /usr/local/mysql/bin/mysqld_safe
    這一步死掉了 我在找不到local 下面找不到mysql

發佈留言