日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

gperftools mysql_利用 gperftools 对nginx mysql 内存管理 性能优化

發布時間:2023/12/10 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 gperftools mysql_利用 gperftools 对nginx mysql 内存管理 性能优化 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

利用?gperftools?對nginx?與?mysql??進行?內存管理??性能優化?降低負載.

Gperftools?是由谷歌開發。官方對gperftools?的介紹為:

These tools are for use by developers so that they can create more robust applications. Especially of use to those developing multi-threaded applications in C++ with templates. Includes TCMalloc, heap-checker, heap-profiler and cpu-profiler.

首先下載軟件安裝包:

由于我們的系統為CentOS 5.8 x64的系統, 64位系統需要先安裝?libunwind?支持庫。

wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz

gperftools 2.0版本

wget http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz

安裝軟件包

tar zxvf libunwind-1.1.tar.gz

cd libunwind-1.1

./configure

make && make install

tar zxvf gperftools-2.0.tar.gz

cd gperftools-2.0

./configure?--enable-frame-pointers

make && make install

增加?gperftools 線程目錄

mkdir /tmp/tcmalloc

設置權限

chmod 777 /tmp/tcmalloc

配置lib?庫文件目錄

vim /etc/ld.so.conf

增加

/usr/local/lib

/sbin/ldconfig????使之生效

重新編譯nginx?使其支持gperftools

tar zxvf nginx-1.2.3.tar.gz

cd nginx-1.2.3

./configure --user=upload --group=upload --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-google_perftools_module

make && make install

安裝完畢以后,?修改?nginx?配置文件?nginx.conf

vim /opt/local/nginx/con/nginx.conf

在pid?下面增加

#gperftools

google_perftools_profiles /tmp/tcmalloc;

然后保存,啟動nginx

/opt/local/nginx/sbin/nginx -t??查看配置是否正常

lsof -n | grep tcmalloc??查看是否運行

nginx???? 18454??? upload?? 10w????? REG??????????????? 8,2????????? 0?? 10780681 /tmp/tcmalloc.18454

nginx???? 18455??? upload?? 12w????? REG?????????????? ?8,2????????? 0?? 10780682 /tmp/tcmalloc.18455

---------------------------------------------------------------------------------

優化Mysql 則不需要重新編譯mysql 只需要找到?mysqld_safe 這個文件

在# executing mysqld_safe 下面加上

export LD_PRELOAD=/usr/local/lib/libtcmalloc.so

然后重啟mysql 就可以啦.

總結

以上是生活随笔為你收集整理的gperftools mysql_利用 gperftools 对nginx mysql 内存管理 性能优化的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。