AgentBaker icon indicating copy to clipboard operation
AgentBaker copied to clipboard

fix: reduce hosts plugin refresh interval

Open saewoni opened this issue 6 months ago • 6 comments

Summary

  • reduce the AKS LocalDNS hosts setup timer refresh interval from 15 minutes to 10 seconds
  • tighten timer accuracy from 1 minute to 1 second so the shorter cadence is honored
  • update the timer comments to describe the new refresh behavior

Validation

  • git diff --check
  • systemd-analyze verify parts/linux/cloud-init/artifacts/aks-localdns-hosts-setup.timer
  • docker run --rm -v "/home/sakwa/agentbaker:/src" shellspec-docker --shell bash --format d spec/parts/linux/cloud-init/artifacts/cse_config_spec.sh

saewoni avatar Jun 02 '26 00:06 saewoni

why 10s? we went from 15min to 10s — that's ~90x more frequent. some concerns before this lands:

  1. load math. on a 1000-node cluster × ~10s period × N critical FQDNs = ~100N dig qps against upstream. RandomizedDelaySec=5s only spreads across 5s of a 10s window, so peak smoothing is ~50%. what's the typical critical-FQDN count, and have we measured this against VNet DNS / 168.63.129.16 headroom? agentbaker #7797 is the precedent — provisioning-timing changes that affect upstream load need a production metric + canary before fleet rollout.

  2. OnUnitInactiveSec vs OnUnitActiveSec. you also changed the semantics. OnUnitInactiveSec=10s fires 10s after the script completes, not every 10s. If aks-localdns-hosts-setup.sh takes 3–5s (multiple dig calls with timeout 3, can retry across upstream servers), the effective period is ~13–15s. Either is fine, but the inline comment still says "10 seconds after each run completes" — OnUnitActiveSec would actually deliver the "every ~10s" reading more people expect. Pick one and make the comment match the semantics.

  3. AccuracySec=1s. default is 1min, which lets systemd coalesce wake-ups across timers. dropping to 1s defeats that batching — small per-node cost but real at fleet scale and not free on battery-constrained / low-end SKUs. is 1s accuracy actually load-bearing here when the wall-clock target is ~10s and the script itself takes longer than that?

  4. why 10s specifically? the prior comment said "15 minutes balances freshness against unnecessary DNS traffic" — that's gone now. what data drove 10s vs 30s vs 1min? if there was a specific stale-IP incident, link the ICM so the next person reading this .timer knows what 10s is calibrated against and when it can be relaxed again.

  5. e2e / perf signal. plan to canary on a small region and watch (a) upstream DNS qps, (b) node CPU/journald write rate from the per-run script logs, (c) any drift in aks-localdns-hosts-setup.service failures before rolling everywhere?

yewmsft avatar Jun 02 '26 04:06 yewmsft

why 10s? we went from 15min to 10s — that's ~90x more frequent. some concerns before this lands:

  1. load math. on a 1000-node cluster × ~10s period × N critical FQDNs = ~100N dig qps against upstream. RandomizedDelaySec=5s only spreads across 5s of a 10s window, so peak smoothing is ~50%. what's the typical critical-FQDN count, and have we measured this against VNet DNS / 168.63.129.16 headroom? agentbaker fix: run aptmarkwalinuxagent hold operation on foreground #7797 is the precedent — provisioning-timing changes that affect upstream load need a production metric + canary before fleet rollout.
  2. OnUnitInactiveSec vs OnUnitActiveSec. you also changed the semantics. OnUnitInactiveSec=10s fires 10s after the script completes, not every 10s. If aks-localdns-hosts-setup.sh takes 3–5s (multiple dig calls with timeout 3, can retry across upstream servers), the effective period is ~13–15s. Either is fine, but the inline comment still says "10 seconds after each run completes" — OnUnitActiveSec would actually deliver the "every ~10s" reading more people expect. Pick one and make the comment match the semantics.
  3. AccuracySec=1s. default is 1min, which lets systemd coalesce wake-ups across timers. dropping to 1s defeats that batching — small per-node cost but real at fleet scale and not free on battery-constrained / low-end SKUs. is 1s accuracy actually load-bearing here when the wall-clock target is ~10s and the script itself takes longer than that?
  4. why 10s specifically? the prior comment said "15 minutes balances freshness against unnecessary DNS traffic" — that's gone now. what data drove 10s vs 30s vs 1min? if there was a specific stale-IP incident, link the ICM so the next person reading this .timer knows what 10s is calibrated against and when it can be relaxed again.
  5. e2e / perf signal. plan to canary on a small region and watch (a) upstream DNS qps, (b) node CPU/journald write rate from the per-run script logs, (c) any drift in aks-localdns-hosts-setup.service failures before rolling everywhere?
  1. dns server load calculation is off. dns server throttling limit is against per vm, azure dns is 1000 qps per vm. so number of nodes does not matter in this calculation.
  2. do you dig in parallel? or in batches? OnUnitInactiveSec=10s is fine.
  3. 1s is fine, since you already randomized delay 5s.
  4. by design
  5. n/a

yewmsft avatar Jun 02 '26 16:06 yewmsft

stop re-review

yewmsft avatar Jun 02 '26 16:06 yewmsft

🔎 Linux Gate Detective — build 167687234 failed

Failed job: Run AgentBaker E2E (Stage e2e)

Detective summary All 10 Test_LocalDNSHostsPlugin* variants (ACL / AzureLinuxV3 / Ubuntu2204 / Ubuntu2404, both default and scriptless_nbc) fail in the in-test validator at validation.go:106 with:

🔴 FAIL: expected exit code 0, but got 1 ERROR: Canary did not resolve after 60s — hot-reload after cold start broken

Failures are uniform across distros and bootstrap modes, exactly on the code path this PR modifies (localdns hosts-plugin refresh interval). Non-hosts-plugin scenarios on the same build cluster are passing, so this is deterministic, not flake.

Class: test failure (E2E) — likely PR-caused product regression Confidence: High Signature: localdns-hostsplugin-canary-hotreload-timeout (proposed new) Wiki: AgentBaker Gate PR Pipeline Flakiness

Strongest alternative theory considered: shared-cluster / test-infra flake. Ruled out — failure is uniform across 10 unrelated VHD flavors and both bootstrap modes, the validator explicitly exercises the modified hosts-plugin hot-reload path, and other tests on the same build run pass. (Separate, unrelated Test_*_NetworkIsolated* / HTTPSProxy_PrivateDNS failures on this build match existing test-infra signatures networkisolated-apiserver-fqdn-nxdomain and httpsproxy-fixture-proxy-unreachable — not PR-caused, not the gate's primary blocker.)

Recommended next action: PR author to revisit the new hosts plugin refresh interval — current value appears to delay hot-reload past the validator's 60s canary timeout after a cold start with an empty hosts file. Suggest verifying the refresh timer fires (and jitter window) within the canary budget, or relaxing the validator timeout if the new interval is intentional.

(Automated by Clawpilot AgentBaker Linux Gate Detective Watcher; signature merge into wiki is handled centrally.)

aks-node-assistant[bot] avatar Jun 11 '26 21:06 aks-node-assistant[bot]

AgentBaker Linux gate detective

Run: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=168798000
Failed job/stage/task: Run AgentBaker E2E
Summary: E2E matches the ongoing shared-cluster/fleet outage. LocalDNSHostsPlugin failures occurred with nodes still carrying NetworkUnavailable=True / Waiting for cloud routes, and the shared dual-stack cluster be2e-azure-overlay-dualstack-v6-4a24b later entered Failed/Deleting. Concurrent CIS/SSH lane issues are separate.
Likely cause/signature: shared-cluster-fleet-outage.
Confidence: high.
Strongest alternative: PR #8620's LocalDNS change caused the LocalDNS test failures; less likely because the same run also shows shared cluster lifecycle failure and cloud-route taints across multiple OS/scenarios.
Recommended next action/owner: E2E shared-cluster infra owners; continue repair item https://msazure.visualstudio.com/CloudNativeCompute/_workitems/edit/38373323.
Wiki: shared-cluster-fleet-outage — https://dev.azure.com/msazure/09706533-03bf-4b43-9a9b-b49c75429646/_wiki/wikis/ed4a85e9-1085-4151-a39b-2753523eba2b?pagePath=%2FAKS%2FSIGs%20and%20Teams%2FAKS%20Components%2FSIG%3A%20Node%20Lifecycle%2FAI%20Agent%20Knowledge%2FAgentBaker%20Gate%20PR%20Pipeline%20Flakiness

aks-node-assistant[bot] avatar Jun 20 '26 00:06 aks-node-assistant[bot]

@C:\Users\SYLVAI~1\AppData\Local\Temp\ab-gate-pr8620-168815871-comment.md

aks-node-assistant[bot] avatar Jun 22 '26 16:06 aks-node-assistant[bot]