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

Optimisations - Round 3 #108

Merged
merged 48 commits into from
Mar 18, 2023
Merged

Optimisations - Round 3 #108

merged 48 commits into from
Mar 18, 2023

Conversation

lquerel
Copy link
Contributor

@lquerel lquerel commented Jan 26, 2023

This PR is a massive update of the underlying infrastructure used to encode/decode OTLP to/from OTLP Arrow messages.
In the previous version the AdaptiveSchema was used to dynamically adapt the schema for fields that can be either a dictionary or a primitive/binary type (e.g. Int32, String, Binary).

This PR introduce a more general system called RecordBuilderExt (ext for extension to the standard Arrow RecordBuilder). The RecordBuilderExt interprets special annotations attached to the Arrow Schema of OTEL entities. There are currently 2 types of annotation supported:

  • optional: used to qualify a field as optional
  • dictionary: used to qualify a field as a dynamic dictionary able to detect index overflow and react accordingly either by selecting a better type for the index or by fall-backing to the value type of the dictionary.

This modification aims to improve the performance (CPU, memory allocation, compression) of small batches (<100) and to some extent improve a bit the performance of bigger batches.

Note: On the decoder side, we treat all the fields as optional as in protobuf. Logically some fields are mandatory but in fact, at the protobuf level, nothing prevents them from being optional. A default value will be assigned to any missing field (as in pdata).

A new set of unit tests have been added to track dictionary overflow for metrics, logs, and traces.

Updated benchmark results have been included into the README.md file.

@lquerel lquerel linked an issue Jan 26, 2023 that may be closed by this pull request
@lquerel lquerel self-assigned this Jan 26, 2023
@lquerel lquerel added the performance Performance improvement, benchmarks label Jan 26, 2023
@lquerel lquerel added this to the Beta V2 milestone Jan 26, 2023
@jmacd jmacd self-requested a review February 17, 2023 21:52
pkg/otel/arrow_record/arrow_record.go Outdated Show resolved Hide resolved
pkg/otel/arrow_record/producer.go Outdated Show resolved Hide resolved
pkg/otel/arrow_record/producer.go Outdated Show resolved Hide resolved
pkg/otel/common/otlp2/doc.go Outdated Show resolved Hide resolved
pkg/otel/common/schema/builder/int.go Show resolved Hide resolved
@lquerel lquerel marked this pull request as ready for review March 17, 2023 18:18
Copy link
Collaborator

@jmacd jmacd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand now how schema building and transformation works at the high level. Looks good. I noticed a few places where panic makes sense now. I filed #121 to make sure the collector won't die in case of panics.

pkg/arrow/from_struct.go Outdated Show resolved Hide resolved
pkg/otel/common/schema/transform_node.go Show resolved Hide resolved
pkg/otel/common/schema/transform_node.go Show resolved Hide resolved
@lquerel lquerel merged commit 7c38029 into main Mar 18, 2023
@jmacd jmacd deleted the 106-optimization-round-3 branch April 7, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance improvement, benchmarks
Projects
Development

Successfully merging this pull request may close these issues.

Optimization - Round 3
2 participants