Skip to content

Reduce Beacon CPU and memory usage - #19

Merged
jakthom merged 3 commits into
mainfrom
codex/reduce-beacon-resource-usage
Aug 8, 2026
Merged

jakthom merged 3 commits into
mainfrom
codex/reduce-beacon-resource-usage

Conversation

@jakthom

@jakthom jakthom commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • maintain compact per-connector queue aggregates transactionally so live statistics no longer scan retained envelope rows
  • lower the default retention cap from 100,000 to 10,000 and show the effective defaults and retention behavior in the UI
  • keep exact traffic counters while sampling expensive source field/raw diagnostics, bounding cardinality, and limiting rich snapshots to requested sensors
  • replace idle connector polling with append notifications and reduce UI polling, stream buffers, DOM churn, serialization work, and listener lifetimes
  • expose authored and effective connector buffers separately through MCP, scope filtered source-metric reads before rich snapshot work, and add get_latest_payloads

MCP latest-payload contract

get_latest_payloads returns exactly one current decoded payload per configured-source/sensor/PGN stream. sensor_id is the stable Device NAME hex when known and address:<source_address> otherwise. Calls can filter by source_id, sensor_id, source_address, device_name_hex, and PGN. Beacon overwrites one bounded in-memory payload per stream on every message; it does not accumulate payload history, and values reset on restart.

Validation

  • go test ./...
  • race-enabled tests for queue, stats, connector, UI, store, config, and MCP packages
  • go vet ./...
  • node --check internal/ui/assets/app.js
  • fresh-database migration and rendered connector-form smoke test

Migration notes

Schema migration 5 creates queue_aggregates and performs a one-time backfill from the canonical queue and checkpoint tables. Normal append, acknowledgement, and prune operations then maintain the aggregate row in the same transaction as the underlying queue state.

Retention limits apply to retained rows, including messages still pending delivery; the UI and docs now make that explicit.

@jakthom
jakthom merged commit f106c1d into main Aug 8, 2026
8 checks passed
@jakthom
jakthom deleted the codex/reduce-beacon-resource-usage branch August 10, 2026 18:28
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