Skip to content

fix(chart): mesh-dns 50m CPU request, no CPU limit, GOMAXPROCS=2 (#1253) - #1260

Merged
bpalermo merged 2 commits into
mainfrom
fix/1253-mesh-dns-cpu
Oct 5, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/1253-mesh-dns-cpu

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #1253

What

mesh-dns is every managed pod's resolver and was CFS-throttled at steady state (25m request / 100m limit; ~24.5m average usage; nr_throttled 16851 / nr_periods 193397 = 8.7 % on w05). This PR:

  • Removes the default CPU limit and raises the CPU request 25m -> 50m (agent.meshDnsDaemon.resources). Same pattern as the agent (agent: the 200m CPU limit turns 5–25 ms snapshot builds into 100 ms CFS steps and parks goroutines holding the cache mutex — remove the limit (or ≥1000m) and pin GOMAXPROCS #1116) and the authz sidecar: request = scheduling reservation + CFS weight, no quota on a latency-critical path.
  • Pins GOMAXPROCS=2 via a new agent.meshDnsDaemon.goMaxProcs (same shape as agent.goMaxProcs). Go 1.25+ derives GOMAXPROCS from the CPU limit with a floor of 2, so under the old 100m limit the daemon already ran with 2 Ps. Without a limit it would scale to the node's cores, and the GC's background workers (25 % of Ps) with it, for a process whose work is a map lookup or a UDP round trip. Pinning 2 keeps today's runtime behaviour exactly. 0/empty omits the env var.
  • Empty limits.cpu renders no limit. The template now drops empty or null quantities instead of rendering cpu: "", which the apiserver rejects. Non-map keys such as claims pass through.
  • Memory is unchanged (32Mi/64Mi). This container sets no GOMEMLIMIT (it never used aether.goMemLimit), so nothing there changes.
  • QoS: already Burstable (requests != limits), and it stays Burstable. Nothing in the chart or docs assumed Guaranteed, a LimitRange or a ResourceQuota for mesh-dns.
  • Surge roll budget: the second pod per node now requests 50m instead of 25m.
  • Chart 2.4.6 -> 2.4.7.

Rendered resources

Before (2.4.6):

resources:
  limits:
    cpu: 100m
    memory: 64Mi
  requests:
    cpu: 25m
    memory: 32Mi
# no GOMAXPROCS env (runtime-derived from the limit: 2)

After (2.4.7):

env:
  - name: GOMAXPROCS
    value: "2"
resources:
  limits:
    memory: 64Mi
  requests:
    cpu: 50m
    memory: 32Mi

Tests

New helm_template_tests in charts/aether/BUILD.bazel:

  • aether_mesh_dns_cpu_resources_test: default has no cpu limit, request 50m, GOMAXPROCS "2". Red against origin/main's chart, green after.
  • aether_mesh_dns_empty_cpu_limit_test: --set ...limits.cpu= renders no cpu limit. Red before (it rendered cpu: ""), green after.
  • aether_mesh_dns_cpu_limit_override_test: --set ...limits.cpu=200m still caps it.

Proof run locally:

  • bazel test //charts/...: 70/70 pass. //agent/internal/proxy/hotrestart:hotrestart_test also passes; it is the only non-chart test that reads values.yaml.
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.
  • make format-check: rc 0.

Docs: docs/configuration.md gets rows for agent.meshDnsDaemon.resources and agent.meshDnsDaemon.goMaxProcs. docs/runbook.md gets a new section, mesh-dns CPU throttling, covering why (resolver tail latency) and how to measure it.

Post-deploy measurement (talos, before/after)

Run the before set on the current release, deploy 2.4.7, wait at least 1h, then run the after set.

cgroup counters (the image is distroless, so read them through a node debug pod):

NODE=w05
POD=$(kubectl get pod -n aether-system -l app.kubernetes.io/component=mesh-dns \
  --field-selector spec.nodeName="$NODE" -o jsonpath='{.items[0].metadata.name}')
CID=$(kubectl get pod -n aether-system "$POD" \
  -o jsonpath='{.status.containerStatuses[?(@.name=="mesh-dns")].containerID}' | sed 's|.*://||')
kubectl debug node/"$NODE" -it --profile=sysadmin --image=busybox:1.37 -- sh -c \
  "d=\$(find /host/sys/fs/cgroup -type d -name \"*$CID*\" | head -1); echo \$d; cat \$d/cpu.max \$d/cpu.stat \$d/cpu.pressure"

Expected after: cpu.max = max 100000, and nr_throttled/throttled_usec stay at 0. The number to compare is then cpu.pressure some avg10/avg60, which captures waits from node contention as well as from the quota. Also compare usage_usec / pod age for average CPU.

Rendered spec check:

kubectl get ds -n aether-system aether-mesh-dns -o jsonpath='{.spec.template.spec.containers[0].resources}{"\n"}{.spec.template.spec.containers[0].env[?(@.name=="GOMAXPROCS")].value}{"\n"}'

PromQL (via the grafana datasource uid prometheus). The cAdvisor queries only work if kubelet cAdvisor is scraped:

# throttled fraction per pod
sum by (pod) (rate(container_cpu_cfs_throttled_periods_total{namespace="aether-system", container="mesh-dns"}[5m]))
  / sum by (pod) (rate(container_cpu_cfs_periods_total{namespace="aether-system", container="mesh-dns"}[5m]))

# CPU used, millicores
1000 * sum by (pod) (rate(container_cpu_usage_seconds_total{namespace="aether-system", container="mesh-dns"}[5m]))

# resolver latency p99 / p999 by path (answered = authoritative mesh hit, forwarded = kube-dns round trip)
histogram_quantile(0.99,
  sum by (le, result) (rate(aether_mesh_dns_query_duration_seconds_bucket{result=~"answered|forwarded"}[1h])))
histogram_quantile(0.999,
  sum by (le, result) (rate(aether_mesh_dns_query_duration_seconds_bucket{result=~"answered|forwarded"}[1h])))

Compare the same 1h window shape before and after, at similar load. The expected change is in the tail, not the median.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits October 5, 2026 12:31
mesh-dns is every managed pod's resolver and was CFS-throttled at steady
state: 25m request / 100m limit, ~24.5m average usage, 8.7 % of periods
throttled on a live talos node. Drop the default CPU limit (same call as
the agent in #1116) and raise the request to 50m, its CFS weight under
contention. Pin GOMAXPROCS=2 (agent.meshDnsDaemon.goMaxProcs), which is
what the Go runtime derived from the old 100m limit, so the daemon does
not scale its Ps and GC workers to the node's cores. An empty limits.cpu
is dropped rather than rendered as `cpu: ""`. Memory unchanged; this
container sets no GOMEMLIMIT. QoS stays Burstable.

Chart 2.4.7. Docs: configuration.md rows and a runbook section on
measuring mesh-dns throttling.

Closes #1253

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the fix/1253-mesh-dns-cpu branch from 9572d3f to 5dd7b5e Compare October 5, 2026 15:31
@bpalermo
bpalermo merged commit f7245d6 into main Oct 5, 2026
24 checks passed
@bpalermo
bpalermo deleted the fix/1253-mesh-dns-cpu branch October 5, 2026 16:01
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.

mesh-dns: CFS-throttled at steady state (25m request / 100m limit)

1 participant