jemalloc Mongodb Nginx 优化
下载
http://www.canonware.com/jemalloc/download.html
下载 wget http://www.canonware.com/download/jemalloc/jemalloc-3.5.0.tar.bz2
tar jxvf jemalloc-3.5.0.tar.bz2
cd jemalloc
./configure && make && make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
ldconfig
1. 优化Mongodb
yum -y install numactl
编译安装以后!! 重启Mongodb 进程
export LD_PRELOAD='/usr/local/lib/libjemalloc.so' && numactl --interleave=all /opt/local/mongodb/bin/mongod xxxxx
2. 优化Nginx
重新编译 Nginx
./configure --user=upload --group=upload --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-ld-opt="-ljemalloc"
make && make install
lsof -n | grep jemalloc
验证jemalloc 是否生效