-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add --track-peak-rss to daemon #2696
Conversation
forest/daemon/src/daemon.rs
Outdated
None | ||
}; | ||
if let Some(mem_stats_tracker) = &mem_stats_tracker { | ||
mem_stats_tracker.run_async(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this background task be added to the services?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that will make its usage a bit complicated for other tools, e.g. statediff, forest-cli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about exposing the async loop and then letting the caller spawn a task? Or maybe just use std::thread::spawn
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Now I won't accidentally run the function from a non-async context. :)
99742c7
to
30c8d9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this may be helpful to track the daemonized process, but in general, for benchmark, I'd use /usr/bin/time -v
. Application self-reporting memory metrics of itself is shady. I'm okay with merging this, though.
Command being timed: "target/release/forest --chain calibnet"
User time (seconds): 1.18
System time (seconds): 0.57
Percent of CPU this job got: 8%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:19.70
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 120804
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 32
Minor (reclaiming a frame) page faults: 36876
Voluntary context switches: 16040
Involuntary context switches: 347
Swaps: 0
File system inputs: 900872
File system outputs: 89856
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
@LesnyRumcajs Thanks! That's a much better option, I kinda confused |
Summary of changes
Changes introduced in this pull request:
RSS is included in Prometheus metrics but it's still helpful to track and print it when forest is not in long-running mode (e.g.
--halt-after-import
), so that we could easily get peak RSS usage from log when runningforest --import-snapshot [path] --halt-after-snapshot --track-peak-rss
without using an external monitoring script, to fill in benchmark tablesReference issue to close (if applicable)
Closes
Other information and links
Change checklist
(if possible),
CHANGELOG is
up-to-date. All user-facing changes should be reflected in this document.