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

Fanout: reduce allocation related to staleness tracking #2405

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

thampiotr
Copy link
Contributor

@thampiotr thampiotr commented Jan 15, 2025

PR Description

We typically send a lot of data through appenders (fanout and interceptor), but we always allocate 0-size slice for
the staleness trackers. This results in high allocation in these methods:

image

image

In this change I'm capturing how many staleness trackers we had previously and use that value to allocate the array, which results in 50% less allocation in the entire .Append chain.

image

There is some more allocation in the constructor now, but overall it is a reduction because the slice doesn't need to grow (in most cases):
image

The gains will be even larger the more Fanouts and Interceptors are used in the pipeline.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@thampiotr thampiotr marked this pull request as ready for review January 15, 2025 12:09
@thampiotr thampiotr requested a review from a team as a code owner January 15, 2025 12:09
@thampiotr thampiotr merged commit c58c114 into main Jan 15, 2025
18 checks passed
@thampiotr thampiotr deleted the thampiotr/fanout-allocation-fix branch January 15, 2025 14:41
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.

2 participants