Skip to content

perf(telemetry): reduce idle resource monitoring CPU - #5345

Open
danvernon wants to merge 2 commits into
pingdotgg:mainfrom
danvernon:perf/cpu-optimizations
Open

perf(telemetry): reduce idle resource monitoring CPU#5345
danvernon wants to merge 2 commits into
pingdotgg:mainfrom
danvernon:perf/cpu-optimizations

Conversation

@danvernon

@danvernon danvernon commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Reduce idle resource-monitor sampling from 1 second to 5 seconds when diagnostics are not being viewed.
  • Refresh expensive memory, disk, and command details only for tracked processes, preserving live diagnostics command refreshes.
  • Share desktop-bootstrap polling and settings relative-time ticking across consumers.
  • Document the telemetry behavior and update focused tests.

Why

The always-on telemetry path repeatedly scanned and refreshed process data, while mounted UI consumers created duplicate timers. Those redundant periodic tasks consumed CPU while the app was idle.

Validation

  • cargo fmt --check --manifest-path native/resource-monitor/Cargo.toml
  • cargo test --locked --manifest-path native/resource-monitor/Cargo.toml (15 passed)
  • ./node_modules/.bin/vp test run apps/server/src/resourceTelemetry/NativeTelemetryClient.test.ts (10 passed)
  • Targeted web typecheck, lint, formatting, and diff checks

This PR is separate from the large-thread synchronization batching PR.

Note

Reduce idle CPU usage in resource monitoring and UI polling

  • In the native resource monitor, periodic background samples now refresh CPU only for all processes, then fetch memory/disk/cmd details only for tracked PIDs; command lines are re-read only when unset. Live and on-demand samples continue to refresh everything unconditionally.
  • resolveNativeSampleIntervalMs now returns a 5,000ms interval when there are no live diagnostic subscribers instead of always using 1,000ms.
  • useRelativeTimeTick and useDesktopLocalBootstraps are rewritten with useSyncExternalStore so multiple consumers share a single timer/polling loop that stops when there are no subscribers.
  • Behavioral Change: background telemetry sampling interval increases from 1,000ms to 5,000ms when no live subscribers are present.

Macroscope summarized a94c104.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ff927ef-b460-4c5b-aead-d3c9ed9cd12b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 4, 2026
Comment thread apps/web/src/components/settings/settingsLayout.tsx
@danvernon
danvernon marked this pull request as ready for review August 4, 2026 16:54
@macroscopeapp

macroscopeapp Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved a94c104

Performance optimization that reduces CPU usage by applying consistent 5-second background polling intervals, sharing timers across React components, and limiting expensive process metadata refreshes to tracked processes only. Changes are self-contained with clear intent and appropriate test updates.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant