Centos 6.3 64bit uses tcmalloc to optimize nginx 1. tcmalloc stands for thread-caching malloc, an open-source tool developed by Google. Compared with the standard glibc library's malloc. Tcmalloc has higher memory allocation efficiency and speed than malloc. For more information, see. The URL below. Http://www.mysqlops.com/2011/06/14/google-tcmalloc-malloc.html#more-737 2, now let's get started with letting nginx use tcmalloc in 64bit centos 6.3. All the required software has been uploaded to the attachment. 3. Install the libunwind library.
# Tar xf libunwind-1.0.tar.gz # tar xf libunwind-1.0 # CFLAGS =-fPIC. /configure: add the compilation parameter # make CFLAGS =-fPIC install www.2cto.com. the following error occurs when you execute the command: libtool: install: error: relink 'libunwind-setjmp. la 'with the above command before installing it make [3]: *** [install-libLTLIBRARIES] Error 1 make [3]: leaving directory '/down/libunwind-1.0/src' make [2]: *** [install-am] Error 2 make [2]: Lea Ving directory '/down/libunwind-1.0/src' make [1]: *** [install] Error 2 make [1]: Leaving directory'/down/libunwind-1.0/src' make: * ** [install-recursive] Error 1 causes this problem: autotools compatibility issues. Run the autoreconf-I-f command to re-compile and install it. # Autoreconf-I-f # make clean # CFLAGS =-fPIC. /configure # make CFLAGS =-fPIC install 4, install gpperftools: # tar xf gperftools-2.0.tar.gz # cd gperftools-2.0 #. /configure # make & make install will report the following error: cc1plus: warning: unrecognized command line option "-Wno-unused-result" ake: *** [stacktrace. lo] Why Error 1 occurs in this kind of Error, so it is a 64-bit system. For more in-depth explanations, the installation instructions are available. Recompile the following code. # Make clean #. /configure -- enable-frame-pointers # make & make install # echo "/usr/local/lib">/etc/ld. so. conf. d/usr_local_lib.conf # ldconfig
5. Compile pcre to enable nginx to Support http rewrite. # Tar xf pcre-8.10.tar.gz # cd pcre-8.10 #. /configure # make & make install www.2cto.com 6, compile nginx # tar xf nginx-1.2.3.tar.gz #. /configure -- with-http_ssl_module \ -- with-http_flv_module \ -- with-http_stub_status_module \ -- with-http_gzip_static_module \ -- http-client-body-temp-path =/var/tmp/nginx/client/\ -- http-proxy- temp-path =/var/tmp/nginx/proxy/\ -- http-fastcgi-temp-path =/var/tmp/nginx/fcgi/\ -- http-uwsgi-temp- path =/var/tmp/nginx/uwsgi \ -- http-scgi-temp-path =/var/tmp/nginx/scgi \ -- with-pcre \ -- with-google_perftools_module # make && make install
7. Create the thread directory # mkdir/tmp/tcmalloc # chmod 0777/tmp/tcmalloc 8 for gperftools and modify the nginx configuration file # vim/usr/local/nginx/conf/nginx. conf # pid logs/nginx. pid; google_perftools_profiles/tmp/tcmalloc; add this line 9, start nginx, verify whether tcmalloc is properly loaded #/usr/local/nginx/sbin/nginx # lsof-n | grep tcmalloc nginx 1893 nobody 9 w REG 253,0 0 43018/tmp/tcmalloc.1893 nginx 1894 nobody 11 w REG 43016, 0 0/tmp/tcmalloc.1894 has been replaced successfully.