17、单机运行环境搭建之 --CentOS-6.4下用tcmalloc优化nginx
2013-04-15 09:46
816 查看
一、简介
tcmalloc全称thread-cachingmalloc,是谷歌开发的开源工具。与标准的glibc库的malloc比。tcmalloc在内存分配效率和速度比malloc高。至于为什么比malloc,有兴趣可以参考。下面这个网址。http://www.mysqlops.com/2011/06/14/google-tcmalloc-malloc.html#more-737
二、安装libunwind库。
cd/usr/local wgethttp://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gztarxflibunwind-1.1.tar.gz cdlibunwind-1.1 CFLAGS=-fPIC./configure #添加编译参数 makeCFLAGS=-fPIC makeCFLAGS=-fPICinstall
三、安装gpperftools:
cd/usr/local 用迅雷下载https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz然后上传到/usr/local,因为好像wget下载https的东东是不行的,或者很麻烦。 tar-zxvfgperftools-2.0.tar.gz cdgperftools-2.0 ./configure
make&&makeinstall echo"/usr/local/lib">/etc/ld.so.conf.d/usr_local_lib.conf /sbin/ldconfig
如果以前优化过mysql,那么gperftools就不用装了。
这里开始安装Nginx,参考我的另一篇博客完成操作。
#cd/usr/local/src
#wgethttp://tengine.taobao.org/download/tengine-1.4.4.tar.gz#tarzxvftengine-1.4.4.tar.gz #cdtengine-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_module make makeinstall
四、配置过程
为gperftools创建线程目录mkdir/tmp/tcmalloc
chmod0777/tmp/tcmalloc
修改nginx的配置文件
vi/usr/local/nginx/conf/nginx.conf
#pidlogs/nginx.pid;
google_perftools_profiles/tmp/tcmalloc;
添加这一行
启动nginx,并验证tcmalloc有没有正常加载
#servicenginxrestart
安装一下lsof命令:
yuminstalllsof-y
#lsof-n|greptcmalloc
至此已经替换成功。
相关文章推荐
- 16、单机运行环境搭建之 --CentOS-6.4下使用TCMalloc优化mysql5.6
- 6、单机运行环境搭建之 --CentOS-6.4安装MySQL 5.6.10并修改MySQL的root用户密码
- 8、单机运行环境搭建之 --CentOS-6.4安装vsftpd
- 5、单机运行环境搭建之 --CentOS-6.4拷贝Tomcat7形成集群
- 7、单机运行环境搭建之 --CentOS-6.4安装Memcached
- 11、单机运行环境搭建之 --Centos6.4下mysql5.6.10的性能优化
- 4、单机运行环境搭建之 --CentOS-6.5优化Tomcat7
- 4、单机运行环境搭建之 --CentOS-6.5优化Tomcat8
- 单机运行环境搭建之 --CentOS-6.4安装MySQL 5.6.10并修改MySQL的root用户密码
- 3、单机运行环境搭建之 --CentOS-6.5安装配置Tengine
- 12、单机运行环境搭建之 --Centos6.4下webbench压力测试
- 在CentOS 7 64位操作系统环境下搭建LNMP(Linux+Nginx+MySQL+PHP)来运行Zabbix监控程序
- 基于centos搭建nginx+uwsgi运行django环境
- CentOS搭建Nginx+Mono运行ASP.NET环境
- Discuz!运行环境搭建教程:CentOS+Nginx
- CmsTop 大众版运行环境搭建 (CentOS+Nginx+PHP FastCGI)
- centos 6.4下nginx+uwsgi+flask的运行环境搭建
- 1、单机运行环境搭建之 --CentOS-6.5安装配置JDK-7
- 2、单机运行环境搭建之 --CentOS-6.5安装配置Tomcat8
- 2、单机运行环境搭建之 --CentOS-6.5安装配置Tomcat7