Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AWS hosts, x86 and Graviton

How to apply each node setting on a VM or a Kubernetes node. Which settings have evidence: Kubernetes HFT tuning.

Terms: deployment glossary.

Instances

Graviton first (c8g, c9g): no SMT, so one vCPU is one core. Any x86 is acceptable, c7a over c7i. Pick the smallest size with the cores the test needs; use Spot for tests.

platforminstance typesnotes
AWS Gravitonc8g.xlarge, c8g.2xlarge (Graviton4), c9g.xlarge, c9g.2xlarge (Graviton5)no SMT: a vCPU is a core
AWS x86c7a (AMD, no SMT), c7i.xlarge, c7i.2xlarge, c7i.4xlarge, c7i.metal-24xla c7i.4xlarge has 8 cores with SMT off
  • Put both hosts in one cluster placement group. Not measured here.
  • Compare only within one run and one host pair: two pairs of one instance type can differ.

Kernel command line

Keep the scheduler, the timer tick, RCU callbacks and new interrupts off every CPU but housekeeping. <busy> is the busy CPUs, <hk> housekeeping:

isolcpus=managed_irq,domain,<busy> nohz_full=<busy> rcu_nocbs=<busy> irqaffinity=<hk>

Effect: settings. Kernel reference: kernel-parameters, NO_HZ. On x86 isolate whole cores (SMT off, so one CPU is one core).

platformalso addwhy
AWS x86, bare metaliommu=ptfor a kernel-bypass driver that does not program the IOMMU; a VM has none
AWS Graviton, bare metaliommu.passthrough=1the same, on Arm
EKS latency node (x86)nosmt transparent_hugepage=never hugepagesz=2M hugepages=<n>; no C-state capKubernetes nodes. No cap: C-states

At every boot, kernel 6.12 and later: 0 into /sys/kernel/debug/sched/fair_server/cpu<N>/runtime for each isolated N, after debugfs is mounted (it is not persistent). The fair server’s 1 s timer otherwise sends each isolated CPU a nohz kick and a reschedule IPI and keeps its tick on (traced). Only where nothing real-time runs on those CPUs.

clocksource=tsc tsc=reliable turns the kernel’s TSC checks off: bare metal only, after measuring the TSC against a PTP/PHC reference, never on a VM.

Interrupts and the NIC

Interrupt moderation means the NIC waits to batch several packets into one interrupt: less CPU, more latency (ENA driver).

settinghowevidence
every movable interrupt on housekeeping, irqbalance stopped/proc/irq/*/smp_affinity_list, /proc/irq/default_smp_affinity; systemctl disable --now irqbalancenot measured here
NIC queue interrupts pinned again after every NIC resetENA puts each queue’s interrupt back on CPU i when the interface comes up (reset, ethtool -G/-L, a NIC handed back by a kernel-bypass driver). Re-pin on each link eventas above
ENA moderation offethtool -C <if> adaptive-rx off rx-usecs 0; ENA turns adaptive moderation back on when the interface comes up, so re-apply it with the pinsnot measured here
receive ringethtool -G <if> rx 4096not measured here
global busy pollingnet.core.busy_read, busy_pollit reaches every socket read on the host: leave unset and busy-poll per socket (SO_BUSY_POLL). Aeron’s media driver: hft

C-states

A C-state is how deeply an idle CPU sleeps: deeper saves power but wakes later. A spinning core never idles; the housekeeping core that takes the interrupts does.

hostsettingevidence
x86 VMcap only the IRQ CPU (ergon-tune T20)not measured here
x86 metalcap only the IRQ CPU (ergon-tune T20)not measured here
Gravitonnothing to setthe OS has no C-states to pick: an idle core waits for an interrupt (WFI)

Memory

settinghowevidence
transparent hugepages offtransparent_hugepage=never on the boot line, or never into /sys/kernel/mm/transparent_hugepage/enabledtranshuge; traced: khugepaged ran a kworker on an isolated CPU (nri-shared-cpus)
2 MiB hugepage poolhugepagesz=2M hugepages=<n> on the boot line, or vm.nr_hugepagesAeron’s hugetlbfs (and any kernel-bypass driver) draws from it
Aeron’s directory on a sized hugetlbfsmount -t hugetlbfs -o pagesize=2M,size=1G nodev /mnt/huge-aeron; on the media driver AERON_FILE_PAGE_SIZE=2097152, AERON_TERM_BUFFER_SPARSE_FILE=falsewithout size= Aeron sees no free space and refuses every log buffer (hft)
net.core.rmem_max, wmem_max16 MiBneeded only when Aeron’s socket buffers are raised above the kernel’s limit (hft)
automatic NUMA balancing offsysctl -w kernel.numa_balancing=0not measured here (one-node lab hosts)

Time

chrony on the Amazon Time Sync Service (169.254.169.123), or on the ENA’s PTP clock. Configuration: time sync.

CPU layout

One physical core per role. SMT is off on x86 latency nodes (SMT off), so one CPU is one core:

corex86 (SMT off)Graviton (no SMT)
housekeeping: interrupts, Aeron’s conductor, client conductorsCPU 0CPU 0
application, busy-spinningone CPUone CPU
media driver senderone CPUone CPU
media driver receiverone CPUone CPU
  • io_uring SQPOLL: its kernel thread spins, so give it a CPU of the pod’s own, not the loop’s SMT sibling (not measured here).
  • Name one CPU per core. thread_siblings_list still lists the offline twin; use the lowest id of each core. AWS numbers x86 siblings N and N + cores.

Build for the CPU

  • x86: rusteron builds Aeron’s C with -march=native unless RUSTERON_C_MARCH names another, so build the media driver on, or for, the instance type it runs on. For an image that runs on several types, name a baseline such as x86-64-v2 (armv8.2-a on Graviton), never the build host’s CPU.
  • Graviton: Rust with RUSTFLAGS=-Ctarget-cpu=neoverse-v2 (Graviton4), neoverse-v3 (Graviton5) or native; C with CFLAGS=-mcpu=.... Without it, Ubuntu’s and Debian’s gcc call a library helper for each atomic (gcc’s -moutline-atomics default on AArch64). On AArch64 -march sets only the architecture; -mcpu sets the core. Latency effect not measured here.

Check it

ergon-tune runs these checks, at start-up or as the ergon-tune command on the node, and prints each finding with its fix.