feat: add profiling of Orchestrion#217
Merged
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
- Coverage 61.51% 60.79% -0.73%
==========================================
Files 91 91
Lines 4841 4902 +61
==========================================
+ Hits 2978 2980 +2
- Misses 1537 1593 +56
- Partials 326 329 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Add hidden flags to enable profiling Orchestrion. Options for writing
CPU and heap profiler, as well as execution traces, with a configurable
path prefix. Enabling the profiler for the parent enables it for the
children. There is one of each enabled profile type per process, and
each file gets the PID in its name.
Note that CPU profiling adds a ~200ms delay at the end of the app to
stop profiling. This might matter more for Orchestrion since there are
many normally short-lived processes.
Execution tracing should be enabled with caution since traces can be
quite large. Even the other profile types can produce significant
amounts of data. The profiles will have redundant symbol data. The CPU
and heap profiles can be combined into a single profile to eliminate the
redundancy.
Example usage:
$ mkdir profiles
$ orchestrion --profile-prefix=${PWD}/profiles --cpu-profiling=true go build
# To combine the profiles:
$ go tool pprof -proto profiles/*.pprof > cpu.pprof
# To view:
$ go tool pprof -http=localhost:6060 cpu.pprof
9a85353 to
c688347
Compare
RomainMuller
requested changes
Aug 14, 2024
* Add "ORCHESTRION_" prefix to env vars. * Use a single argument for enabling profiling, which can be repeated or given a comma-separated value to enable multiple profilers. * Don't rely on the order of arg parsing. Enable profiles in the Before function, which runs after args are parsed. * Changed profile-prefix to profile-path, and create the path if it doesn't exist. * Don't store the profile path in a global var. Retrieve it in Before after parsing args and pass it to wherever its needed via function arguments.
nsrip-dd
commented
Aug 14, 2024
Contributor
Author
nsrip-dd
left a comment
There was a problem hiding this comment.
Thanks for the review @RomainMuller. I made several changes based on your comments.
RomainMuller
approved these changes
Aug 14, 2024
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.
What does this PR do?
Add hidden flags to enable profiling Orchestrion. Options for writing
CPU and heap profiler, as well as execution traces, with a configurable
path prefix. Enabling the profiler for the parent enables it for the
children. There is one of each enabled profile type per process, and
each file gets the PID in its name.
Note that CPU profiling adds a ~200ms delay at the end of the app to
stop profiling. This might matter more for Orchestrion since there are
many normally short-lived processes.
Execution tracing should be enabled with caution since traces can be
quite large. Even the other profile types can produce significant
amounts of data. The profiles will have redundant symbol data. The CPU
and heap profiles can be combined into a single profile to eliminate the
redundancy.
Example usage:
Motivation
Looking for hot spots & bottlenecks in Orchestrion
Reviewer's Checklist