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

perf(transform): Improve AggregateToArray Throughput #150

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

jshlbrd
Copy link
Contributor

@jshlbrd jshlbrd commented Mar 21, 2024

Description

  • Improves the performance (throughput) of the AggregateToArray transform
  • Simplifies the JSON Lines pattern in the config library

Motivation and Context

I noticed this transform was involved in causing slowdown in some production data pipelines. Based on benchmark results, this change increases the throughput dramatically:

main:

% ./cmd/development/benchmark/substation/substation -file ./examples/config/transform/aggregate/summarize/data.jsonl -config ./examples/cmd/development/benchmark/aggregate/config.json -count 10000
2024-03-20T20:08:59.253422-07:00: Configuring Substation
2024-03-20T20:08:59.255327-07:00: Loading data into memory
2024-03-20T20:08:59.263569-07:00: Starting benchmark
2024-03-20T20:09:13.166251-07:00: Ending benchmark

Benchmark results:
- 190000 events in 13.902677334s
- 13666.43 events per second
- 14 MB in 13.902677334s
- 1.01 MB per second

This PR:

% ./cmd/development/benchmark/substation/substation -file ./examples/config/transform/aggregate/summarize/data.jsonl -config ./examples/cmd/development/benchmark/aggregate/config.json -count 10000
2024-03-20T20:11:12.093623-07:00: Configuring Substation
2024-03-20T20:11:12.095701-07:00: Loading data into memory
2024-03-20T20:11:12.10391-07:00: Starting benchmark
2024-03-20T20:11:12.534654-07:00: Ending benchmark

Benchmark results:
- 190000 events in 430.74925ms
- 441091.89 events per second
- 14 MB in 430.74925ms
- 32.59 MB per second

The config that was benchmarked only calls this transform:

local sub = import '../../../../../build/config/substation.libsonnet';

{
  transforms: [
    sub.tf.agg.to.array(),
  ]
}

How Has This Been Tested?

Using the benchmark app (see above).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jshlbrd jshlbrd marked this pull request as ready for review March 21, 2024 03:28
@jshlbrd jshlbrd requested a review from a team as a code owner March 21, 2024 03:28
@jshlbrd jshlbrd merged commit d730cc6 into main Mar 21, 2024
7 checks passed
@jshlbrd jshlbrd deleted the jshlbrd/perf/agg-to-array branch March 21, 2024 14:54
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 this pull request may close these issues.

None yet

2 participants