mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 09:32:45 +01:00
The memory watch only runs mock mode, and mock mode drops pushed agent reports and skips state broadcasts without a subscriber. It can never reach the cost #2199 measured: every accepted report refreshes the unified resource registry and broadcasts state to connected dashboards. Add scripts/memory/agent_load.py, a stdlib-only driver that mints one install token per synthetic Unified Agent through the dev admin bypass, posts gzip host reports from 30 agents every 30s (6 also send Docker reports with 40 containers each), and keeps one dashboard WebSocket connected. It counts a report as failed after the agent's own 15s timeout and fails the run when reports were not accepted, so a run that missed the path cannot pass as a measurement. compare_release_memory.sh takes PULSE_FOOTPRINT_ESTATE=agents to start a real, authenticated Pulse under that load, and a new compare-agents job runs it nightly. It reports without gating (PULSE_MEMORY_GATE=0) and the issue reporter does not read it, so the new estate cannot open the memory watch issue. Five-minute runs on pulse-dev, v6.7.0 against main: all 360 reports accepted on both builds, 270 resources registered, and a CPU profile showed HandleReport -> ApplyHostReport -> replaceRegistryLocked and the websocket merge patch, the #2199 chain. Both builds used 5.7% of a core, wrote about 6.5 GB/day, and answered host reports at a 50 ms median but a 1.7-1.9 s p95 and 4 s maximum. Mock runs are unchanged apart from the legacy key path, which keeps hosts with an installed Pulse from refusing to start.
195 lines
7.4 KiB
YAML
195 lines
7.4 KiB
YAML
name: Memory Regression Watch
|
|
|
|
# Pulse's resident memory rose release after release without anything noticing
|
|
# (#1803): a 256 MB LXC that ran v5 for a year needed 1 GB by v6.3. Nothing
|
|
# compared memory across versions, and part of the growth sat outside the Go
|
|
# heap, where heap-only tests cannot see it. This watch builds the latest stable
|
|
# release and main from source, runs both against the same small mock estate,
|
|
# and compares resident memory split into the Go heap, memory outside Go and
|
|
# file pages. Both heap profiles and their difference are uploaded, so a failure
|
|
# names what grew. SQLite page caches only fill on large databases, which a
|
|
# short mock run never builds; pkg/db's page cache tests guard those instead.
|
|
# The compare-agents job repeats the comparison on a real Pulse driven by
|
|
# synthetic agents, because mock mode never reaches the agent report path.
|
|
on:
|
|
schedule:
|
|
- cron: '41 4 * * *'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: memory-regression
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
compare:
|
|
name: Compare memory with the latest stable release
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Checkout candidate
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
path: candidate
|
|
persist-credentials: false
|
|
|
|
- name: Resolve the latest stable release
|
|
id: stable
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
run: |
|
|
set -euo pipefail
|
|
tag="$(gh release view --json tagName,isPrerelease --jq 'select(.isPrerelease | not) | .tagName')"
|
|
[[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "No stable release tag found: '${tag}'" >&2; exit 1; }
|
|
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
|
|
echo "Baseline: ${tag}"
|
|
|
|
- name: Checkout baseline
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ steps.stable.outputs.tag }}
|
|
path: baseline
|
|
persist-credentials: false
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
|
with:
|
|
go-version-file: candidate/go.mod
|
|
cache: false
|
|
|
|
- name: Measure both builds
|
|
env:
|
|
# Each tree builds with the toolchain its own go.mod names.
|
|
GOTOOLCHAIN: auto
|
|
PULSE_MEMORY_DURATION: '900'
|
|
run: bash candidate/scripts/memory/compare_release_memory.sh baseline candidate "$RUNNER_TEMP/memory"
|
|
|
|
- name: Publish the comparison
|
|
if: ${{ !cancelled() }}
|
|
run: |
|
|
if [[ -f "$RUNNER_TEMP/memory/summary.md" ]]; then
|
|
cat "$RUNNER_TEMP/memory/summary.md" >> "$GITHUB_STEP_SUMMARY"
|
|
else
|
|
echo "The measurement did not finish; see the run logs." >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
- name: Upload memory evidence
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: memory-regression
|
|
path: |
|
|
${{ runner.temp }}/memory/*.tsv
|
|
${{ runner.temp }}/memory/*.pb.gz
|
|
${{ runner.temp }}/memory/heap-growth.txt
|
|
${{ runner.temp }}/memory/summary.md
|
|
${{ runner.temp }}/memory/result.json
|
|
${{ runner.temp }}/memory/run-*.log
|
|
if-no-files-found: ignore
|
|
retention-days: 30
|
|
|
|
# The same comparison on a real Pulse fed by synthetic Unified Agents and one
|
|
# connected dashboard (scripts/memory/agent_load.py). Mock mode drops pushed
|
|
# agent reports, so only this estate reaches the per-report registry refresh
|
|
# and broadcast cost #2199 measured. It reports without gating until its noise
|
|
# is known, and the scheduled reporter below does not read it, so its result
|
|
# never opens or comments on the memory watch issue.
|
|
compare-agents:
|
|
name: Compare an agent estate with the latest stable release
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 45
|
|
steps:
|
|
- name: Checkout candidate
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
path: candidate
|
|
persist-credentials: false
|
|
|
|
- name: Resolve the latest stable release
|
|
id: stable
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
run: |
|
|
set -euo pipefail
|
|
tag="$(gh release view --json tagName,isPrerelease --jq 'select(.isPrerelease | not) | .tagName')"
|
|
[[ "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "No stable release tag found: '${tag}'" >&2; exit 1; }
|
|
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
|
|
echo "Baseline: ${tag}"
|
|
|
|
- name: Checkout baseline
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ steps.stable.outputs.tag }}
|
|
path: baseline
|
|
persist-credentials: false
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
|
with:
|
|
go-version-file: candidate/go.mod
|
|
cache: false
|
|
|
|
- name: Measure both builds under agent load
|
|
env:
|
|
GOTOOLCHAIN: auto
|
|
PULSE_MEMORY_DURATION: '900'
|
|
PULSE_FOOTPRINT_ESTATE: agents
|
|
PULSE_MEMORY_GATE: '0'
|
|
run: bash candidate/scripts/memory/compare_release_memory.sh baseline candidate "$RUNNER_TEMP/memory-agents"
|
|
|
|
- name: Publish the comparison
|
|
if: ${{ !cancelled() }}
|
|
run: |
|
|
if [[ -f "$RUNNER_TEMP/memory-agents/summary.md" ]]; then
|
|
cat "$RUNNER_TEMP/memory-agents/summary.md" >> "$GITHUB_STEP_SUMMARY"
|
|
else
|
|
echo "The agent estate measurement did not finish; see the run logs." >> "$GITHUB_STEP_SUMMARY"
|
|
fi
|
|
|
|
- name: Upload agent estate evidence
|
|
if: ${{ !cancelled() }}
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: memory-regression-agents
|
|
path: |
|
|
${{ runner.temp }}/memory-agents/*.tsv
|
|
${{ runner.temp }}/memory-agents/*.pb.gz
|
|
${{ runner.temp }}/memory-agents/heap-growth.txt
|
|
${{ runner.temp }}/memory-agents/summary.md
|
|
${{ runner.temp }}/memory-agents/result.json
|
|
${{ runner.temp }}/memory-agents/agents-*.json
|
|
${{ runner.temp }}/memory-agents/agents-*.log
|
|
${{ runner.temp }}/memory-agents/run-*.log
|
|
if-no-files-found: ignore
|
|
retention-days: 30
|
|
|
|
# Report only marked, untouched watch issues. A passing check is not
|
|
# resolution of a human report; recovery comments never close issues.
|
|
report-scheduled-result:
|
|
name: Report scheduled result
|
|
needs: compare
|
|
if: ${{ always() && github.event_name == 'schedule' }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- name: Checkout exact reporter source
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Report the watch observation without resolving issues
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
GH_REPO: ${{ github.repository }}
|
|
RESULT: ${{ needs.compare.result }}
|
|
run: python3 .github/scripts/report-ci-watch.py memory "$RESULT"
|