跳轉到

tuned / sysctl / cpufreq

GRUB 設定的是 boot-time 不可變參數;本章是 runtime 可調的部分。

tuned profile

sudo systemctl enable --now tuned
sudo tuned-adm profile network-latency

network-latency(內含 latency-performance)是 RHEL 針對低延遲網路場景設計的調校 profile,涵蓋 CPU、記憶體、網路各層面的優化,直接套用即可。

驗證:

tuned-adm active
# Current active profile: network-latency

sysctl 設定

/etc/sysctl.d/99-hugepages.conf

vm.nr_hugepages = 128

Runtime 階段的 hugepage 配置最低保證。GRUB 已經預配 256,這裡只是再次確認。

/etc/sysctl.d/90-quote-mcast.conf

net.ipv4.conf.<行情NIC>.rp_filter = 2

行情 multicast 走獨立 NIC 進來。若該 NIC 的 reverse-path filter(rp_filter)為 strict(1,多數 distro 預設),而行情 feed source 子網的反向路由走另一張 NIC, kernel 會在 IP routing 層靜默丟掉每一個行情封包——quote-receiver 完全收不到、 UdpInErrors 也不會動。這是 multi-homed 主機的典型陷阱,事後查極耗時 (見 常見錯誤對照)。

裝機時就把行情 NIC 設成 loose(2)一勞永逸;loose 仍擋真正路由不到的偽造來源。 若行情 NIC 是專用、上面不跑其他流量,設 0(全關)亦可——兩者對行情都是修好, strict(1)才是唯一會出事的值。

interface-specific sysctl 的開機時序

net.ipv4.conf.<NIC>.rp_filter 這類綁定特定 NIC 的設定,開機套用時需該 NIC 已建立。sysctl --system 若在 NIC 出現前執行會跳過該行。重開機後務必複查 sysctl net.ipv4.conf.<行情NIC>.rp_filter;若被打回 1,改用 NetworkManager dispatcher script 或 udev rule 在 NIC up 時設定。

套用

sudo sysctl --system

# 驗證
sysctl vm.nr_hugepages

cpufreq Governor

sudo cpupower frequency-set -g performance

確保 CPU 跑在最高頻率(E-2388G base 3.20 GHz、實際達 4.6 GHz turbo——所有核因 GRUBidle=poll 永遠活躍,PCU 套 8-core turbo bin)。

驗證:

cpupower frequency-info | grep "current policy"
# current policy: ... governor "performance"

不要再手動改 isolated cores 的 cpuidle/governor

在 isolated cores 上額外手動覆寫 cpuidle / governor(除了 tuned 之外又加一層)反而造成效能退化。

結論:只用 tuned 設定,不要再手動覆寫

排錯

  • tuned-adm active 顯示其他 profile → 重設 sudo tuned-adm profile network-latency,然後 systemctl enable tuned

  • 重開機後 sysctl 設定失效 → 確認檔案在 /etc/sysctl.d/(非 /run/sysctl.d/)。後者是 runtime overlay 不持久