New Post has been published on ITESSAYS
New Post has been published on http://itessays.com/other/using-tcmalloc-optimize-nginx-performance.html
Using TCMalloc optimize Nginx performance
library Malloc, TCMalloc library on memory allocation efficiency and speed is much higher, largely improves server performance under high concurrency, thereby reducing the load on the system.
tcmalloc-opspersec.vs.size.20.threads
1. install libunwind
download libunwind: http://download.savannah.gnu.org/releases/libunwind/
install step:
tar –zxvf libunwind-0.99.tar.gz cd libunwind-0.99 CFLAGS=-fPIC ./configure make CFLAGS=-fPIC make CFLAGS=-fPIC install echo "/usr/local/lib" >/etc/ld.so.conf.d/usr_local_lib.conf /sbin/ldconfig
 2. install google-preftools
download link:Â http://download.chinaunix.net/download.php?id=32582&ResourceID=12865
chmod 700 google-perftools-1.9.tar.gz tar -zxvf google-perftools-1.9.tar.gz cd google-perftools-1.9 ./configure make && make install echo "/usr/local/lib" >/etc/ld.so.conf.d/usr_local_lib.conf /sbin/ldconfig
 3. Recompile Nginx
cd nginx-1.5.8 ./configure --with-google_perftools_module --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module make && make install
 4. Add thread for google-perftools
mkdir –p /tmp/tcmalloc chmod 0777 /tmp/tcmalloc
 5. Modify Nginx main configuration file
vim /usr/local/nginx/conf/nginx.conf: #pid logs/nginx.pid; google_perftools_profiles /tmp/tcmalloc;
 6.  Verify google-perftools normal load, the command View:
lsof –n |grep tcmalloc [root@localhost conf]# lsof -n |greptcmalloc nginx 15017 www 10w REG 253,0 0 801420 /tmp/tcmalloc.15017 nginx 15018 www 12w REG 253,0 0 801417 /tmp/tcmalloc.15018 nginx 15019 www 14w REG 253,0 0 801415 /tmp/tcmalloc.15019 nginx 15020 www 16w REG 253,0 0 784898 /tmp/tcmalloc.15020 nginx 15021 www 18w REG 253,0 0 801274 /tmp/tcmalloc.15021 nginx 15022 www 20w REG 253,0 0 801414 /tmp/tcmalloc.15022 nginx 15023 www 22w REG 253,0 0 801418 /tmp/tcmalloc.15023 nginx 15024 www 24w REG 253,0 0 801419 /tmp/tcmalloc.15024
Set worker_processes value of 8 for Nginx main configuration file Nginx.conf, so opened eight Nginx threads, each thread has a row. Each thread file behind the numeric value is the pid of the Nginx.
Use TCMalloc optimization Nginx can improve server performance under high concurrency, reduce system load, so that the server stable and efficient operation.
    .CPlase_panel display:none;
















