ARM服务器优化指导

  • BIOS

请按下图进行配置

ARM服务器优化指导 - 图1

ARM服务器优化指导 - 图2

ARM服务器优化指导 - 图3

  • 操作系统

请按如下方式修改/etc/sysctl.conf配置文件修改内核参数

  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 = 32000 1024000000 500 32000
  23. kernel.shmall = 52805669
  24. kernel.shmmax = 18446744073692774399
  25. sys.fs.file-max = 6536438
  26. net.core.wmem_max = 21299200
  27. net.core.rmem_max = 21299200
  28. net.core.wmem_default = 21299200
  29. net.core.rmem_default = 21299200
  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 = 5270325
  34. net.core.netdev_max_backlog = 65535
  35. net.ipv4.tcp_max_syn_backlog = 65535
  36. net.ipv4.tcp_syncookies = 1
  37. vm.overcommit_memory = 0
  38. net.ipv4.tcp_retries1 = 5
  39. net.ipv4.tcp_syn_retries = 5
  40. ##NEW
  41. kernel.sched_autogroup_enabled=0
  42. kernel.sched_min_granularity_ns=2000000
  43. kernel.sched_latency_ns=10000000
  44. kernel.sched_wakeup_granularity_ns=5000000
  45. kernel.sched_migration_cost_ns=500000
  46. vm.dirty_background_bytes=33554432
  47. kernel.shmmax=21474836480
  48. net.ipv4.tcp_timestamps = 0
  49. net.ipv6.conf.all.disable_ipv6=1
  50. net.ipv6.conf.default.disable_ipv6=1
  51. net.ipv4.tcp_keepalive_time=600
  52. net.ipv4.tcp_keepalive_probes=3
  53. kernel.core_uses_pid=1

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

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

调优启动参数,将如下配置加入内核启动参数:

  1. iommu.passthrough=1
  • 调优硬盘/SSD

请按如下方式格式化分区,其中nvme0n1p1为测试机上NVMe盘名,请替换为本机NVMe盘名:

  1. mkfs.xfs -f -b size=8192 -s size=512 /dev/nvme0n1p1

将如下配置项加入内核参数以启用BFQ:

  1. scsi_mod.use_blk_mq=1
  • 网络

请按照厂商建议安装网卡驱动程序并配置消息队列长度,以华为Hi1822网卡为例,请参考如下链接安装Hi1822智能网卡驱动:

https://support.huawei.com/enterprise/de/doc/EDOC1100063073/42928ba6/configuring-64-queues

配置消息队列为64:

  1. ./hinicconfig hinic0 -f std_sh_4x25ge_dpdk_cfg_template0.ini

请按如下方式配置IRQ:

先禁用irqbalance系统服务;随后按照如下方式进行配置(以下enp5s0/enp4s0/enp3s0仅为示例,请根据实际情况替换为本机网卡名):

四路ARM服务器单网卡:

  1. /var/scripts/set_irq_affinity_256.sh -x all enp4s0.

四路ARM服务器双网卡:

  1. /var/scripts/set_irq_affinity.sh -x 16-32,48-64,80-95,112-128 enp4s0
  2. /var/scripts/set_irq_affinity.sh -x 146-161,176-191,208-224,240-256 enp5s0

两路ARM服务器单网卡:

  1. /var/scripts/set_irq_affinity_128.sh -x all enp3s0

两路ARM服务器双网卡:

  1. ./set_irq_affinity.sh -x 0-63 enp3s0
  2. ./set_irq_affinity.sh -x 64-128 enp4s0

四路服务器上请按如下方式配置中断:

  1. ethtool -C enp4s0 adaptive-rx off adaptive-tx off rx-usecs 62 tx-usecs 62

两路服务器上请按如下方式配置中断:

  1. ethtool-C enp4s0 adaptive-rx off adaptive-tx off rx-usecs 50 tx-usecs 50

配置增大缓冲区大小以调优网卡:

  1. ethtool -G enp4s0 rx 4096 tx 4096

修改网卡参数,服务端为on,客户端为off:

  1. ethtool -K $net_dev tso on/off
  2. ethtool -K $net_dev lro on/off
  3. ethtool -K $net_dev gro on/off
  4. ethtool -K $net_dev gso on/off

调优rc_local,其中<256/128\\>处请按照本机物理核心数设置:

  1. killall -9 polkitd
  2. service sysmonitor stop
  3. service irqbalance stop
  4. service rsyslog stop
  5. service firewalld stop
  6. echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
  7. /var/scripts/net_tune.sh enp4s0
  8. /var/scripts/net_tune.sh enp5s0
  9. ethtool -G enp4s0 rx 4096 tx 4096
  10. ethtool -G enp5s0 rx 4096 tx 4096
  11. /var/scripts/set_irq_affinity_<256/128>.sh -x all enp4s0
  12. ethtool -C enp4s0 adaptive-rx off adaptive-tx off rx-usecs 62 tx-usecs 62