Skip to content

perf(config): HZ 100→1000 to cut container-start latency (ABX-496) - #14

Closed
AprilNEA wants to merge 2 commits into
masterfrom
perf/hz-1000-container-churn
Closed

perf(config): HZ 100→1000 to cut container-start latency (ABX-496)#14
AprilNEA wants to merge 2 commits into
masterfrom
perf/hz-1000-container-churn

Conversation

@AprilNEA

Copy link
Copy Markdown
Member

Why

Cross-engine docker build bench (ABX-496) on a matched host found ArcBox ~8–13× slower than Colima on per-step-heavy builds, while throughput-bound shapes (large context, real network builds) were only 1.3–1.9×. Localization (all in-guest, proxy ruled out):

  • Gap is guest-side: in-guest build ≈ via-proxy build (proxy/vsock/relay adds ~0.5 s, not the gap).
  • Not disk: guest fsync on docker.img and overlay mount are ~0.5 ms.
  • Not namespace primitives: unshare -mpnf ~0.2 ms.
  • Not the snapshotter: both engines run overlayfs via the containerd (c8d) snapshotter.
  • It's container-START latency: docker start -a 0.74 s (ArcBox) vs 0.15 s (Colima); docker run busybox true floor 1.13 s vs 0.22 s. Each docker build RUN/COPY step is a container, so this multiplies (12-stage: 12.7 s vs 1.5 s).

Root cause: the ArcBox guest kernel is CONFIG_HZ=100 (10 ms tick); Colima's guest (Ubuntu 6.8) is CONFIG_HZ=1000 (1 ms tick). Container start is a chain of jiffy-rounded scheduler waits across the containerd-poll / shim-handshake-completion / runc / dockerd↔containerd-gRPC-backoff IPC path; at HZ=100 each rounds up to 10 ms, so a start pays dozens of 10 ms quanta where Colima pays 1 ms. HZ=100 was the initial-commit default and was never revisited (only PREEMPT_LAZY has a defending comment).

Change

CONFIG_HZ_100 → CONFIG_HZ_1000 on both arm64 and x86_64 defconfigs.

Why it's a clean win

NO_HZ_IDLE=y is set, so the tick is off when idle regardless of HZ — the idle-CPU target (root CLAUDE.md <0.05%) is unaffected. The only cost is more timer interrupts under active load, which is exactly when we want finer scheduling for container churn. For a build/dev runtime chasing OrbStack parity, this is the right trade.

Validation

Config-only; needs a kernel build + boot-assets bundle bump to measure end-to-end. Expected: the 8–13× per-step rows move toward the 1.3–1.9× throughput-bound band. A secondary ~10 % came from rcu_expedited=1 in the same probe (not included here to keep the change minimal; can follow as a cmdline tweak if wanted). Re-run the ABX-496 bench harness after the bundle bump.

Refs: ABX-496.

Container start is a chain of jiffy-rounded scheduler waits across the
containerd/shim/runc/dockerd IPC handshake; at HZ=100 each rounds up to
10 ms. Cross-engine bench (ABX-496) measured container churn ~5x slower
than a matched Colima guest (HZ=1000), which dominates multi-step docker
builds (each step is a container): simple cold 8.1s vs 0.6s, 12-stage
12.7s vs 1.5s. NO_HZ_IDLE keeps the tick off when idle, so the idle-CPU
target is unaffected — the cost is purely more timer interrupts under
active load, the right trade for a build/dev runtime chasing OrbStack
parity.
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

ABX-496

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR raises the kernel timer frequency to reduce container-start latency. The main changes are:

  • Select 1000 Hz for the ARM64 kernel configuration.
  • Select 1000 Hz for the x86_64 kernel configuration.
  • Verify the selection after Kconfig resolution in both build paths.

Confidence Score: 5/5

This looks safe to merge.

The post-configuration check covers both native and Docker builds.

No blocking issues found in the changed code.

T-Rex T-Rex Logs

What T-Rex did

  • Before-side capture recorded the copied fragment requesting CONFIG_HZ_1000=y and CONFIG_HZ=1000, and noted that the Kconfig generators were absent.
  • Prerequisite evidence confirms flex, bison, bc, and pahole are not installed, and that Docker and QEMU are unavailable for this run.
  • After-side capture records the actual build-script run and the failure: flex not found during olddefconfig, with exit code 2.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
configs/arcbox-arm64.config Changes the ARM64 kernel timer frequency from 100 Hz to 1000 Hz.
configs/arcbox-x86_64.config Changes the x86_64 kernel timer frequency from 100 Hz to 1000 Hz.
scripts/build-kernel.sh Checks that the 1000 Hz selection survives Kconfig resolution in native and Docker builds.

Reviews (2): Last reviewed commit: "build: assert CONFIG_HZ_1000 survives ol..." | Re-trigger Greptile

Comment thread configs/arcbox-arm64.config
The HZ bump is a choice symbol; olddefconfig silently drops or rewrites
unsatisfiable choices, so guard it the same way the script already
guards the squashfs/netfilter symbols.
@AprilNEA

Copy link
Copy Markdown
Member Author

Local validation result — this is a minor win, not the ABX-496 fix

Built this config locally, swapped the HZ=1000 kernel into a bench guest (confirmed CONFIG_HZ=1000 booted), and ran a differential sweep vs a matched Colima guest.

  • Container-start floor improved ~25 %: docker start -a 0.74 s → 0.55 s; docker run busybox true 1.13 s → 0.86 s.
  • Build level barely moved: simple 3-RUN cold 8.12 s → 8.57 s (noise), 12-stage 12.70 s → 11.45 s (~10 %), cached rebuild 1.80 s → 1.78 s.

So HZ=1000 is a small, clean improvement (NO_HZ_IDLE keeps the idle-CPU target intact), worth taking on its own merits — but it does NOT close the 8–13× build gap vs Colima. The dominant differentiator turned out to be elsewhere: runtime binaries (runc/containerd-shim, 11–17 MB) are executed from the host-backed VirtioFS share and page in ~8× slower than guest-local (ABX-496, Factor 2). Retitling this away from "the fix" — recommend merging as an incremental latency improvement, decoupled from the ABX-496 resolution.

@AprilNEA

Copy link
Copy Markdown
Member Author

Superseded by #16 — the HZ=1000 change ships there alongside voluntary preemption and PSI-default-off as one coherent container-start-latency release (ABX-498).

@AprilNEA AprilNEA closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant