X86服务器优化指导
以下是用于优化Intel x86服务器(以Dell 2路服务器为例)上运行MOT时的建议配置。这些设置是高吞吐量工作负载的最佳选择。
BIOS:
- Hyper Threading需设置为ON
操作系统:
禁用NUMA平衡,如下所述。MOT以极其高效的NUMA-aware方式进行内存管理,远远超过操作系统使用的默认方法。
echo 0 > /proc/sys/kernel/numa_balancing
禁用部分系统服务:
service sysmonitor stop # OPTIONAL, performance
service irqbalance stop # MANADATORY
service rsyslog stop # OPTIONAL, performance
调优系统服务:
调优守护程序使用Throughput-performance配置文件
[...]$ tuned-adm profile throughput-performance
调优Sysctl,请按如下方式修改/etc/sysctl.conf配置文件后运行sysctl -p –
net.ipv4.ip_local_port_range = 9000 65535
kernel.sysrq = 1
kernel.panic_on_oops = 1
kernel.panic = 5
kernel.hung_task_timeout_secs = 3600
kernel.hung_task_panic = 1
vm.oom_dump_tasks = 1
kernel.softlockup_panic = 1
fs.file-max = 640000
kernel.msgmnb = 7000000
kernel.sched_min_granularity_ns = 10000000
kernel.sched_wakeup_granularity_ns = 15000000
kernel.numa_balancing=0
vm.max_map_count = 1048576
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries2 = 80
kernel.sem = 250 6400000 1000 25600
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
#net.sctp.sctp_mem = 94500000 915000000 927000000
#net.sctp.sctp_rmem = 8192 250000 16777216
#net.sctp.sctp_wmem = 8192 250000 16777216
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
net.core.somaxconn = 65535
vm.min_free_kbytes = 26351629
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
#net.sctp.addip_enable = 0
net.ipv4.tcp_syncookies = 1
vm.overcommit_memory = 0
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
请按如下方式修改/etc/security/limits.conf对应部分
<user> soft nofile 100000
<user> hard nofile 100000
- 确保磁盘/SSD性能
请按如下方式运行磁盘/SSD性能测试,若性能测试结果显著低于789MB/s将严重影响MOT性能。
[...]$ sync; dd if=/dev/zero of=testfile bs=1M count=1024; sync
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 1.36034 s, 789 MB/s
- 网络
需使用10Gbps或更高速率网卡,请按如下方式测试:
服务器侧:
iperf -s
客户侧:
iperf -c <服务端IP>
同时请按如下方式优化网络:
从https://gist.github.com/SaveTheRbtz/8875474将set_irq_affinity.sh下载到/var/scripts/目录
进入/etc/rc.d/rc.local目录,并按如下方式操作:
chmod +x /etc/rc.d/rc.local
var/scripts/set_irq_affinity.sh -x all <DEVNAME>
ethtool -K <DEVNAME> gro off
ethtool -C <DEVNAME> adaptive-rx on adaptive-tx on
Replace <DEVNAME> with the network card