Skip to content
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

goroutinedumper: Compress files #36846

Closed
bdarnell opened this issue Apr 15, 2019 · 1 comment · Fixed by #36922
Closed

goroutinedumper: Compress files #36846

bdarnell opened this issue Apr 15, 2019 · 1 comment · Fixed by #36922

Comments

@bdarnell
Copy link
Contributor

Goroutine dumps are large, but compress well. With default settings, the goroutine dumper will fire when there are 1000 goroutines, which produces a file of about 9MB that gzips down to 500KB. We should compress the files we write here (and probably reduce the total_dump_size_limit - spending half a gig on this is kind of silly when we only budget 100MB for logs in util/log).

I'm noticing this because #35986 produces 400MB of goroutine dumps per run (twice the size of its log files), so stressing it keeps filling up my local disk.

@tbg
Copy link
Member

tbg commented Apr 15, 2019

@giorgosp -- if you're interested in knocking out another issue, this one would be a good follow-up to #36813. Basically in this code

func takeGoroutineDump(dir string, filename string) error {
path := filepath.Join(dir, filename)
f, err := os.Create(path)
if err != nil {
return errors.Wrapf(err, "error creating file %s for goroutine dump", path)
}
defer f.Close()
if err = pprof.Lookup("goroutine").WriteTo(f, 2); err != nil {
return errors.Wrapf(err, "error writing goroutine dump to %s", path)
}
return nil
}

we wouldn't pass f to WriteTo, but we'd wrap f it in a gzip.NewWriter, and perform the necessary cosmetics (i.e. chose a filename ending in .txt.gz, adapt debug zip to use a .txt.gz ending as well). I think the GetFiles endpoint would just return the compressed files, which is what we want.

giorgosp added a commit to giorgosp/cockroach that referenced this issue Apr 17, 2019
giorgosp added a commit to giorgosp/cockroach that referenced this issue Apr 19, 2019
craig bot pushed a commit that referenced this issue Apr 19, 2019
36922: goroutinedumper: Gzip files r=tbg a=giorgosp

Fixes #36846

Release note: None

Co-authored-by: George Papadrosou <[email protected]>
@craig craig bot closed this as completed in #36922 Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants