Bug 426965 - Cache heaptrack parse
Summary: Cache heaptrack parse
Status: RESOLVED NOT A BUG
Alias: None
Product: Heaptrack
Classification: Applications
Component: general (show other bugs)
Version: 1.2.0
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Milian Wolff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-25 16:09 UTC by Andrew Somerville
Modified: 2021-12-18 12:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Somerville 2020-09-25 16:09:25 UTC
SUMMARY

When analyzing very large results (e.g. 8gb heaptrack file), waiting for parsing can take many minutes. Any subsequent runs of heaptrack_print or heaptrack_gui incur the same cost. 

It would be extremely useful to have an intermediate cache/artifact which could be used to jump over the parsing step, and allow faster re-loading of data. This is especially useful when sharing with collaborators, or for automated workflows where heaptrack profiling is done asynchronously and results provided later.
Comment 1 Andrew Somerville 2020-09-25 16:21:39 UTC
Addendum:

 * Loading takes 10s of minutes in the case of an 8GB file.
 * Unintentional process terminations (crashes, accidental window close) are of particular issue for heaptrack_gui
Comment 2 Milian Wolff 2020-09-28 10:35:44 UTC
Is the 8GB file compressed or uncompressed? It sounds like it's uncompressed - try to compress it via `zstd` to create a `*.zst` file - that greatly reduces the disk-I/O time and should make things considerably faster I bet.

That said, I have some ideas on how to speed parsing up more too, but that will require a complete rewrite of the data structure... I hope I get to that eventually, but cannot promise anything.
Comment 3 Andrew Somerville 2020-09-28 16:29:34 UTC
Looks like I got the original number wrong it's 4gb compressed with gz (and 65GB uncompressed! geeze) I'll try switching to zstd and see what the speed looks like.

Also I started adding some information to the processing window with respect to which pass it was on and the timestamp currently being worked on for my own sake. I'll create a PR in case that's desirable more generally.

Looking into if there's a way to parallelize the first pass as well.
Comment 4 Milian Wolff 2020-09-29 07:20:33 UTC
OK that's a huge amount of data, which corresponds to a ton of allocations...

I mean just for the fun of it, try to do something like this:

zcat <yourfile> | grep -cE '^[\+-]'

That will give us the number of allocation events. I suspect this to be a _very_ large number. As a workaround, until we find some improvements to this, here are some suggestions:

- only track a smaller workload for your application, i.e. reduce the problem size, or the duration for which you are tracing
- use runtime attaching to ignore the startup phase if that is allocation heavy

Otherwise, I'm afraid to say that zstd is the only quick thing you could try. It's much faster at decompressing the data compared to gzip, so that will be noticeable to you. But in the end we'll still have to crunch through 65GB of data, which just takes a really long time...
Comment 5 Milian Wolff 2021-12-18 12:32:52 UTC
this bug report isn't really actionable as-is, so I'm closing it