X86服务器优化指导

以下是用于优化Intel x86服务器(以Dell 2路服务器为例)上运行MOT时的建议配置。这些设置是高吞吐量工作负载的最佳选择。

BIOS:

  • Hyper Threading需设置为ON

操作系统:

  • 禁用NUMA平衡,如下所述。MOT以极其高效的NUMA-aware方式进行内存管理,远远超过操作系统使用的默认方法。

    1. echo 0 > /proc/sys/kernel/numa_balancing
  • 禁用部分系统服务:

    1. service sysmonitor stop # OPTIONAL, performance
    2. service irqbalance stop # MANADATORY
    3. service rsyslog stop # OPTIONAL, performance
  • 调优系统服务:

调优守护程序使用Throughput-performance配置文件

  1. [...]$ tuned-adm profile throughput-performance

调优Sysctl,请按如下方式修改/etc/sysctl.conf配置文件后运行sysctl -p –

  1. net.ipv4.ip_local_port_range = 9000 65535
  2. kernel.sysrq = 1
  3. kernel.panic_on_oops = 1
  4. kernel.panic = 5
  5. kernel.hung_task_timeout_secs = 3600
  6. kernel.hung_task_panic = 1
  7. vm.oom_dump_tasks = 1
  8. kernel.softlockup_panic = 1
  9. fs.file-max = 640000
  10. kernel.msgmnb = 7000000
  11. kernel.sched_min_granularity_ns = 10000000
  12. kernel.sched_wakeup_granularity_ns = 15000000
  13. kernel.numa_balancing=0
  14. vm.max_map_count = 1048576
  15. net.ipv4.tcp_max_tw_buckets = 10000
  16. net.ipv4.tcp_tw_reuse = 1
  17. net.ipv4.tcp_tw_recycle = 1
  18. net.ipv4.tcp_keepalive_time = 30
  19. net.ipv4.tcp_keepalive_probes = 9
  20. net.ipv4.tcp_keepalive_intvl = 30
  21. net.ipv4.tcp_retries2 = 80
  22. kernel.sem = 250 6400000 1000 25600
  23. net.core.wmem_max = 21299200
  24. net.core.rmem_max = 21299200
  25. net.core.wmem_default = 21299200
  26. net.core.rmem_default = 21299200
  27. #net.sctp.sctp_mem = 94500000 915000000 927000000
  28. #net.sctp.sctp_rmem = 8192 250000 16777216
  29. #net.sctp.sctp_wmem = 8192 250000 16777216
  30. net.ipv4.tcp_rmem = 8192 250000 16777216
  31. net.ipv4.tcp_wmem = 8192 250000 16777216
  32. net.core.somaxconn = 65535
  33. vm.min_free_kbytes = 26351629
  34. net.core.netdev_max_backlog = 65535
  35. net.ipv4.tcp_max_syn_backlog = 65535
  36. #net.sctp.addip_enable = 0
  37. net.ipv4.tcp_syncookies = 1
  38. vm.overcommit_memory = 0
  39. net.ipv4.tcp_retries1 = 5
  40. net.ipv4.tcp_syn_retries = 5

请按如下方式修改/etc/security/limits.conf对应部分

  1. <user> soft nofile 100000
  2. <user> hard nofile 100000
  • 确保磁盘/SSD性能

请按如下方式运行磁盘/SSD性能测试,若性能测试结果显著低于789MB/s将严重影响MOT性能。

  1. [...]$ sync; dd if=/dev/zero of=testfile bs=1M count=1024; sync
  2. 1024+0 records in
  3. 1024+0 records out
  4. 1073741824 bytes (1.1 GB) copied, 1.36034 s, 789 MB/s
  • 网络

需使用10Gbps或更高速率网卡,请按如下方式测试:

服务器侧:

  1. iperf -s

客户侧:

  1. iperf -c <服务端IP>

同时请按如下方式优化网络:

https://gist.github.com/SaveTheRbtz/8875474将set_irq_affinity.sh下载到/var/scripts/目录

进入/etc/rc.d/rc.local目录,并按如下方式操作:

  1. chmod +x /etc/rc.d/rc.local
  2. var/scripts/set_irq_affinity.sh -x all <DEVNAME>
  3. ethtool -K <DEVNAME> gro off
  4. ethtool -C <DEVNAME> adaptive-rx on adaptive-tx on
  5. Replace <DEVNAME> with the network card