-
Notifications
You must be signed in to change notification settings - Fork 98
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
Report GCP profiles from zoekt-git-index #816
Merged
+8
−4
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import ( | |
) | ||
|
||
// Init starts the supported profilers IFF the environment variable is set. | ||
func Init(svcName, version string, blockProfileRate int) { | ||
func Init(svcName, version string) { | ||
jtibshirani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") != "" { | ||
err := profiler.Start(profiler.Config{ | ||
Service: svcName, | ||
|
@@ -21,3 +21,17 @@ func Init(svcName, version string, blockProfileRate int) { | |
} | ||
} | ||
} | ||
|
||
// InitLightweight starts the supported profilers IFF the environment variable is set. | ||
// Compared to Init, it disables mutex profiling and forced GC to reduce its overhead. | ||
jtibshirani marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually don't know why we do AllocForceGC given the default is off. I wonder if it has a measurable impact on our perf. I suspect not. Then it makes sense. Why don't we use it for zoekt-git-index then? |
||
func InitLightweight(svcName, version string) { | ||
if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") != "" { | ||
err := profiler.Start(profiler.Config{ | ||
Service: svcName, | ||
ServiceVersion: version, | ||
}) | ||
if err != nil { | ||
log.Printf("could not initialize profiler: %s", err.Error()) | ||
} | ||
} | ||
} |
Oops, something went wrong.
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.
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.
What's the reasoning for having a separate profiler config? Is mutex profiling polluting zoekt-git-index and that's not the case for webserver or indexserver?
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.
Agreed, interesting in why we need a lighterweight indexing config here. Given this will only trigger for slower runs of zoekt-git-index, more info seems useful?
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.
The thing I found concerning was
AllocForceGC: true
. If I'm understanding correctly, it means that enabling profiling could significantly impact memory usage (lower peak usage due to more frequent GCs). So you could have weird things like "we switched off the GCP profiler and now memory usage is much higher."However, it looks like we do this all over the place, including
sg/sg
, and I haven't heard of a problem. I'm probably just scarred from my Java days where WAY more stuff is on the heap and GC behavior is very core to memory usage.I'll remove
InitLightweight
!