-
Notifications
You must be signed in to change notification settings - Fork 896
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
profiles/follow up: location references in sample #4307
Comments
cc @open-telemetry/profiling-maintainers @open-telemetry/profiling-approvers |
Comment from the OTel maintainer meeting: could / should this be moved to a comment on the current Profiling PR in the OTLP repository? |
This issue is linked in https://github.com/open-telemetry/opentelemetry-proto/pull/534/files#r1561128746. As this particular issue is relevant to the specification, I did open the issue in this repository. |
Thanks for raising this.
That should be most CPU profiles, right? @petethepig IIRC you had some benchmarks that showed the efficiency of this new encoding of stack traces. Did you use realistic CPU profiling data? If this new approach is not a clear win in the majority of situations, we should remove it. |
Most of my experiments are with CPU profiles. |
We could simply make both For example if you had two traces that only vary in the leaf:
Then you could create locations like so:
And then encode the reference like this:
|
@athre0z interesting idea! Do you have an algorithm in mind for encoding the data in this way? A bit of a meta comment: I think it's difficult to evaluate different stack trace encoding schemas without some alignment on how we value encoding vs decoding efficiency, compression, as well as overall complexity. Additionally I suspect that we're reinventing well-known tree encoding formats here (the above looks trie-ish?), and that there is a lot more prior art that we could explore. |
Yeah, this is definitely tree-ish: we're essentially trying to encode a flamegraph tree efficiently. For optimal density we'd probably want some sort of prefix tree structure. That being said, I'm not sure whether we're willing to pay the compute price of maintaining one in the profiler. The algorithm that I had in mind for use with the |
Your algorithm sounds like it could work nicely. That being said, I see two paths forward:
What do you think? |
I don't really have a strong opinion on this. Intuitively I'd guess that this location list may make up a significant portion of message size, but these things tend to be hard to guess. Makes me wish for a protobuf message size profiler that attributes size consumed to message fields. Bonus points if it could also do it for compressed message size! Whether "keeping more compatible with pprof" is a priority, IMHO, depends on whether Google decides to donate the format to OTel or not. If pprof keeps evolving independently, then we'll find ourselves in a C/C++ kind of situation where newer C versions gained features that C++ doesn't have, and it'll just be pure pain to somehow keep things compatible. In that case I'd prefer to intentionally break compatibility to avoid the misconception of interoperability without transpiling. |
One approach I used a couple of times for encoding a tree is with two arrays where one array represents index into the parent node and another array contains the reference to the actual payload. In case of pprof profile this would look something like
Note that the structure-of-arrays approach is used here to minimize allocations at protobuf serialization / deserialization level. Alternative array-of-structures approach would contain a single array of a special One additional nice thing about this representation is that many data processing algorithms for profiling data operate on call trees and storing the data in this encoding even in memory is convenient enough. For example, something like Just as a thought. |
As the protocol is mostly used for transport (and possibly storing), can we assume that compression like gzip or zstd is applied on top? Evaluation results should also contain message size with compression applied to see whether complexity of in-protocol optimization is worth it or not. Just saying because additional compression hasn't been mentioned explicitly in the comments (but maybe this is too obvious 😅). |
@aalexand thanks, this definitely sounds interesting and worth exploring 👍 . @rockdaboot I haven't heard anybody argue against applying gzip. OTLP receiver MUST support it according to the spec. For profiling clients we can, and I think SHOULD, encourage it. So yeah, we should consider compression in our measurements. While doing this we should also agree on some measure of utility that takes into consideration throughput and compression ratio. For some prior art see this research from my colleagues @jbachorik and @thegreystone. (They evaluated only compression algorithms, but I think we could use a similar approach to think about the utility of in-protocol optimizations). |
@felixge I started creating a list of requirements to compare changes in the protocol including different compression types. We can use the ebpf profiler for recording and replaying traces in order to get somewhat reproducible results (hard when GC kicks in and/or exact timing plays a role). But I don't want to "capture" this issue, I'll open an issue against the ebpf profiler in a while. |
@rockdaboot: @petethepig had a repo with benchmarks at some point that used a collection of pprof recordings to evaluate different protocol ideas. While I'm not sure how representative the data was, I generally like the idea of building a collection of profiling data files that we can use for comparison purposes. I can probably get some real data from our prod systems and anonymize if as well. |
@felixge @petethepig The thoughts collected at open-telemetry/opentelemetry-ebpf-profiler#110 and the existing work should well combine. Maybe we can use the issue to discuss, collect further thoughts and track progress. |
Yeah: we'd expect the impact of such a deduplication schema on the compressed message size to be a lot smaller than on the uncompressed size. However, the uncompressed message size is also important because:
|
(transferred to specification repository as part of #4284) |
This is a follow up for open-telemetry/oteps#239 (comment) around
message Sample
and its use oflocation_index
,locations_start_index
andlocations_length
:https://github.com/open-telemetry/oteps/blob/dc619dfc70f174ef31caf90f14e8b00600da4049/text/profiles/0239-profiles-data-model.md?plain=1#L518-L527
As an example, consider the following stack in a folded format:
Like in most stack traces, the base frames are similar, but there is a variation in the leaf frames. To reflect this, the last two traces use different leaf frames,
ghi
andqux
.Should the resulting sample look like the following?
In particular for deep stack traces with a high number of similar frames and where only leaf frames are different, the use of
locations_start_index
,locations_length
withlocation_indices
will get more complex than the (deprecated)location_index
which just holds a list of IDs into the location table.The original pprof message Sample does also not use the
_start_index
/_length
approach. From my understanding all messages of typeSample
within the sameProfile
groups stack traces from the same origin/with the same attributes.For a different set of attributes, I think, a dedicated
Profile
should be preferred with its own attributes.An alternative, to allow sharing
Mapping
,Location
andFunction
information between stack traces with different attributes would be to move these three tables one layer up intoProfileContainer
, so that they can be referenced from eachProfile
.While the variety of leaf frames is usually high and attributes are often more static, can we remove the
deprecated
label fromlocation_index
inmessage Sample
and let the user either setlocation_index
orlocation_start_index
withlocations_length
?The text was updated successfully, but these errors were encountered: