NGINX内存管理优化 gperftools工具安装 Centos

Libunwind安装 64位系统依赖

wget -c http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
tar zxvf libunwind-1.1.tar.gz
cd libunwind-1.1
./configure
make
make install

国内机器可能无法下载 因为被河蟹了

cd ../
wget --no-check-certificate https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.2.1.tar.gz
tar zxvf gperftools-2.2.1.tar.gz
cd gperftools-2.2.1
./configure --enable-frame-pointers
make
make install

echo “/usr/local/lib”>>/etc/ld.so.conf
ldconfig

mkdir /tmp/tcmalloc
chmod 777 /tmp/tcmalloc -R

安装nginx

wget -c http://nginx.org/download/nginx-1.6.0.tar.gz
tar xfz nginx-1.6.0.tar.gz
cd nginx*
./configure --prefix=/usr/local/nginx \
--with-http_image_filter_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-ipv6 \
--with-http_spdy_module \
--with-google_perftools_module
make && make install

nginx.conf 顶部添加
google_perftools_profiles /tmp/tcmalloc;

测试
lsof -n | grep tcmalloc
lsof -n | grep nginx

wget http://www.idclayer.com/public/bash/init/nginx.init
mv nginx.init /etc/init.d/nginx
chmod 755 /etc/init.d/nginx

chkconfig nginx on
service nginx start

chkconfig iptables off
service iptables stop

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注