I. Introduction
Tcmalloc, short for thread-caching malloc, is 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. Install the libunwind library.
CD/usr/local
Wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
Tar xf libunwind-1.1.tar.gz CD libunwind-1.1
Cflags =-FPIC./configure # Add the compilation parameter make cflags =-FPIC install
3. Install gpperftools:
CD/usr/local
Download https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz with thunder
Then upload the file to/usr/local, because it seems that wget cannot download the HTTPS stuff, or it is very troublesome.
Tar-zxvf gperftools-2.0.tar.gz CD gperftools-2.0
./Configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
If you have optimized MySQL before, you do not need to install gperftools.
Install nginx here. Refer to another blog to complete the operation.
# Cd/usr/local/src
#wget http://tengine.taobao.org/download/tengine-1.4.4.tar.gz#tar zxvf tengine-1.4.4.tar.gz#cd tengine-1.4.4
./configure --add-module=/usr/local/src/ngx_cache_purge-2.1 --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.32 --with-google_perftools_modulemake make install
Iv. configuration process
Create a thread directory for gperftools
mkdir /tmp/tcmalloc chmod 0777 /tmp/tcmalloc
Modify the nginx configuration file
VI/usr/local/nginx/CONF/nginx. conf # PID logs/nginx. PID;Google_perftools_profiles/Tmp/Tcmalloc;Add this line
Start nginx and verify that tcmalloc is loaded properly
# Service nginx restart
Install the lsof command:
Yum install lsof-y
# Lsof-N | grep tcmalloc
So far, it has been replaced successfully.