TCMalloc优化Nginx的性能
(4)
[root@localhost install]# tar -zxvf libunwind-0.99-alpha.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/libunwind-0.99-alpha/
[root@localhost libunwind-0.99-alpha]# CFLAGS=-fPIC ./configure
[root@localhost libunwind-0.99-alpha]# make CFALGS=-fPIC
[root@localhost libunwind-0.99-alpha]# make CFALGS=-fPIC install
[root@localhost install]# tar -zxvf google-perftools-1.8.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/google-perftools-1.8
[root@localhost google-perftools-1.8.2]# ./configure
[root@localhost google-perftools-1.8.2]#make
[root@localhost google-perftools-1.8.2]#make install
[root@localhost google-perftools-1.8.2]# echo "/usr/local/lib" >>
/etc/ld.so.conf.d/usr_local_lib.conf
[root@localhost google-perftools-1.8.2]# ldconfig
(5)重新编译nginx
[root@localhost google-perftools-1.8.2]# cd /usr/src/nginx-0.7.65/
[root@localhost nginx-0.7.65]# ./configure --prefix=/usr/local/nginx --with-
http_stub_status_module --with-http_gzip_static_module --with-google_perftools_module
[root@localhost nginx-0.7.65]#make
[root@localhost nginx-0.7.65]#make install
[root@localhost nginx-0.7.65]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/0.7.65
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-
http_gzip_static_module --with-google_perftools_module
[root@localhost nginx-0.7.65]# mkdir /tmp/tcmalloc
[root@localhost nginx-0.7.65]# chmod 0777 /tmp/tcmalloc/
[root@localhost nginx-0.7.65]# vim /usr/local/nginx/conf/nginx.conf
#pid logs/nginx.pid;
google_perftools_profiles /tmp/tcmalloc;
[root@localhost nginx-0.7.65]# lsof -n | grep tcmalloc
(6)php
检查系统安装这些依赖包
[root@localhost install]# rpm -qa | grep libxml2
libxml2-python-2.6.26-2.1.2.8
libxml2-2.6.26-2.1.2.8
libxml2-devel-2.6.26-2.1.2.8
[root@localhost install]# rpm -qa | grep autoconf
autoconf-2.59-12
[root@localhost install]# rpm -qa | grep libjpeg
libjpeg-6b-37
libjpeg-devel-6b-37
[root@localhost install]# rpm -qa | grep libpng
libpng-devel-1.2.10-7.1.el5_3.2
libpng-1.2.10-7.1.el5_3.2
[root@localhost install]# rpm -qa | grep freetype
freetype-2.2.1-21.el5_3
freetype-devel-2.2.1-21.el5_3
[root@localhost install]# rpm -qa | grep zlib
zlib-devel-1.2.3-3
zlib-1.2.3-3
[root@localhost install]# rpm -qa | grep glibc
compat-glibc-2.3.4-2.26
glibc-2.5-42
glibc-devel-2.5-42
glibc-common-2.5-42
compat-glibc-headers-2.3.4-2.26
glibc-headers-2.5-42
[A[root@localhost install]# rpm -qa | grep glib2
glib2-2.12.3-4.el5_3.1
glib2-devel-2.12.3-4.el5_3.1
[root@localhost install]# tar -zxvf php-5.2.13.tar.gz -C /usr/src/
[root@localhost install]# gzip -cd php-5.2.13-fpm-0.5.13.diff.gz | patch -d /usr/src/php-5.2.13 -
p1
[root@localhost install]# cd /usr/src/php-5.2.13/
[root@localhost php-5.2.13]# ./configure --prefix=/usr/local/php --enable-mbstring --enable-
fastcgi --enable-fpm
[root@localhost php-5.2.13]#make
[root@localhost php-5.2.13]#make install
[root@localhost php-5.2.13]# cp php.ini-dist /usr/local/php/lib/php.ini
[root@localhost php-5.2.13]# vim /usr/local/php/etc/php-fpm.con
62 Unix user of processes
63 <value name="user">nobody</value>
64
65 Unix group of processes
66 <value name="group">nobody</value>
[root@localhost php-5.2.13]# echo "/usr/local/php/sbin/php-fpm start" >> /etc/rc.local
[root@localhost php-5.2.13]# netstat -antl | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
[root@localhost php-5.2.13]# ps -ef | grep php-cgi
root 9317 1 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
nobody 9318 9317 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
nobody 9319 9317 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
nobody 9320 9317 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
nobody 9321 9317 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
nobody 9322 9317 0 22:50 ? 00:00:00 /usr/local/php/bin/php-cgi --fpm --fpm-config
/usr/local/php/etc/php-fpm.conf
root 9338 3874 0 22:58 pts/0 00:00:00 grep php-cgi
本文出自 “dsafsa_技术博客” 博客,转载请与作者联系!