一、安装libunwind-1.0.tar.gz

 

  1.   ./configure
  2.   make
  3.   autoreconf -i -f
  4.   make install

 

二、安装gperftools-2.0.tar.gz

 

  1.   ./configure --enable-frame-pointers
  2.   make
  3.   make install

 

三、MYSQL 和NGNINX 编译配置

 

  1.   ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-charset=utf8 --enable-thread-safe-client \ --with-extra-charsets=complex --with-big-tables --with-ssl --enable-assembler --enable-local-infile --with-plugins=innobase --with-plugins=partition \
    --with-mysqld-ldflags=-ltcmalloc
  2. ./configure --with-http_stub_status_module --with-google_perftools_module
  3. google_perftools_profiles /tmp/tcmalloc; 在nginx 主配置 worker_rlimit_nofile 添加此行

 

四、查看是否加载成功

 

[root@localhost webinstall]# lsof -n|awk '{if($0~/tcmalloc/)print $0}'
nginx      6870    nobody   41w      REG              253,0        0     937989 /tmp/tcmalloc.6870
mysqld    22530     mysql  mem       REG              253,0  2216045     948539 /usr/local/lib/libtcmalloc.so.4.1.0