Skip to content

[aggregator] efficiently GC expired aggregation versions#3842

Open
rallen090 wants to merge 13 commits into
masterfrom
ra/agg-cpu-expired
Open

[aggregator] efficiently GC expired aggregation versions#3842
rallen090 wants to merge 13 commits into
masterfrom
ra/agg-cpu-expired

Conversation

@rallen090

@rallen090 rallen090 commented Oct 14, 2021

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it:

Avoid scanning to cleanup expired agg versions.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


@rallen090 rallen090 changed the title GC expired versions [aggregator] efficiently GC expired aggregation versions Oct 14, 2021
var cascadeDirty bool
var (
cascadeDirty bool
expiredTimeNanos = make([]int64, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be better to make this a resettable field on GenericElem so that we don't have to re-alloc it each Consume?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea

@arnikola arnikola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

)

type onForwardedAggregationDoneFn func(key aggregationKey) error
type onForwardedAggregationDoneFn func(key aggregationKey, expiredTimeNanos []int64) error

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: i'd prefer using xtime.UnixNano for new code if possible.

for k, v := range agg.buckets {
v.values = v.values[:0]
v.prevValues = v.prevValues[:0]
for i := 0; i < bucketLen; i++ {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: why not a range?

b.prevValues = append(b.prevValues, prevValue)
if annotation != nil {
b.annotation = annotation
for i := 0; i < len(agg.buckets); i++ {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: range ?


// internal consume state that does not need to be synchronized.
toConsume []timedAggregation // small buffer to avoid memory allocations during consumption
toExpire []int64

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lol we're gonna have a name conflict with the upcoming dirty changes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

well I guess all of this will be a bit of a semantical merge with those changes. no big deal.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this ever inited?

@codecov

codecov Bot commented Oct 15, 2021

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.8%. Comparing base (9a2f021) to head (f8d1b08).
⚠️ Report is 313 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3842     +/-   ##
========================================
- Coverage    57.0%   56.8%   -0.3%     
========================================
  Files         552     552             
  Lines       63129   63129             
========================================
- Hits        36033   35887    -146     
- Misses      23907   24038    +131     
- Partials     3189    3204     +15     
Flag Coverage Δ
aggregator 63.3% <90.6%> (-0.1%) ⬇️
cluster ∅ <ø> (∅)
collector 58.4% <ø> (ø)
dbnode 60.4% <ø> (-0.4%) ⬇️
m3em 46.4% <ø> (ø)
metrics 19.7% <0.0%> (-0.1%) ⬇️
msg 74.4% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a2f021...f8d1b08. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rallen090 rallen090 changed the base branch from ra/agg-cpu-improve to master October 22, 2021 20:56
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.

3 participants