tcmalloc nginx配置

一:安装libunwind库
tar -zxvf libunwind-0.99-alpha.tar.gz -C /usr/src/
cd /usr/src/libunwind-0.99-alpha/
CFLAGS=-fPIC ./configure
make CFLAGS=-fPIC
make CFLAGS=-fPIC install

二:安装gprftools
tar -zxvf google-perftools-1.8.2.tar.gz  -C /usr/src/
cd /usr/src/google-perftools-1.8.2
./configure
make && make install
echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig 

三:重新编译Nginx
cd /usr/src/nginx-0.7.65/
./configure --with-http_gzip_static_module --with-google_perftools_module --with-http_stub_status_module --prefix=/usr/local/nginx
make
make install

到此nginx安装完成

四:为google-perftools添加线程目录
mkdir /tmp/tcmalloc
chmod 0777 /tmp/tcmalloc

五:修改nginx主配置文件
#pid logs/nginx.pid;
google_perftools_profiles /tmp/tcmalloc

重启:nginx服务

验证:lsof -n | grep tcmalloc

你可能感兴趣的:(nginx,LNMP,TCMALLOC)