jemalloc Mongodb Nginx 優化

丶小炒肉發表於2016-05-31

下載

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 是否生效

相關文章