MongoDB调优简记

来源:互联网 发布:requirejs 加载json 编辑:程序博客网 时间:2024/05/17 04:24
2013-07-01 01:46:43 / 分类: 技术 / 标签: MongoDB
  1. 禁止文件系统更新读取次数统计(修改/etc/fstab文件)

    1. mount -o remount,noatime /data
  2. 如果存储的数据中有大的文件,建议使用ext4/xfs这样的文件系统,并隔离IO。

  3. 设置最大打开文件描述符(ulimit)

    1. cat /etc/security/limits.conf
    2. * soft nofile 102400
    3. * hard nofile 102400

    centos 5与centos 6不同的是,只要在/etc/security/limits.conf 设置了root soft nofile 102400 和root hard nofile102400,对应的uilmit -u 后的结果就会是102400,这里需要注意区别! 因此cetos 6还必须这样设置: sed -i 's/1024.*/102400/' /etc/security/limits.d/90-nproc.conf

  4. TCP连接内存优化

    1. cat /etc/sysctl.conf
    2. net.ipv4.tcp_syncookies = 1
    3. net.ipv4.tcp_tw_reuse = 1
    4. net.ipv4.tcp_tw_recycle = 1
    5. net.ipv4.tcp_timestsmps = 0
    6. net.ipv4.tcp_synack_retries = 2
    7. net.ipv4.tcp_syn_retries = 2
    8. net.ipv4.tcp_wmem = 8192 436600 873200
    9. net.ipv4.tcp_rmem = 32768 436600 873200
    10. net.ipv4.tcp_mem = 94500000 91500000 92700000
    11. net.ipv4.tcp_max_orphans = 3276800
    12. net.ipv4.tcp_fin_timeout = 30
    13. #直接生效
    14. /sbin/sysctl -p
  5. 多核问题可以在启动时加入启动参数: numactl --interleave=all

    1. #Advanced
    2.  
    3. numactl --interleave=all /opt/mongodb/bin/mongod -shardsvr -replSet shard1 -port 27021 -dbpath /data0/mongodb/db/shard13 -oplogSize 1000 -logpath /data1/mongodb/logs/shard13.log -logappend --maxConns 10000 --quiet -fork --directoryperdb
发布于:http://www.hiceon.com/topic/mongodb-tiaoyou/
0 0