perf(daemon): arm the processed-map prune timer only while it has entries - #28
Merged
Merged
Conversation
…ries The prune ran on a 60s ticker for the daemon's whole life, though the processed map only gets entries during a pass and they expire 60s later. On a quiet node that woke the daemon every minute to scan an empty map. Arm a one-shot timer only while the map has entries: it fires once or twice after a pass and then stays off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The coordinator pruned its
processedmap on a 60 s ticker for the daemon's whole life. The map only gets entries during a pass (startup,SIGHUP, systemd reload, reconnect), and they expireprocessedTTL(60 s) later. So on a quiet node the daemon woke every minute to scan an empty map.The prune timer is now a one-shot
time.After, armed byarmPruneonly while the map has entries, and kept (not restarted) once armed. After a pass it fires once or twice, then stays off until the next pass.The saving is small: about 1 of the daemon's ~16 wakeups per minute at idle, measured on a production node. The daemon now only wakes at idle for its own lifecycle sweep, the Go runtime and incoming events.
TestCoordinator_PruneArmedOnlyWithEntriescovers four cases:docs/architecture.mdnotes that the timer is armed only while needed.perfbumps no version by itself; it ships with the next release (1.0.1, via fix(processor): log symlinks leading outside /dev at debug unless allowed #27).Pull request checklist
masterbranchmake checklocally before creating the commit and it has run successfullyWIPcommits in this PRType of changes