-
Notifications
You must be signed in to change notification settings - Fork 287
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
sorter: reduce memory malloc to avoid too much CPU overhead #1854
sorter: reduce memory malloc to avoid too much CPU overhead #1854
Conversation
This reverts commit 0ef525f.
/run-all-tests |
/run-kafka-tests |
@@ -159,7 +160,7 @@ func (h *heapSorter) flush(ctx context.Context, maxResolvedTs uint64) error { | |||
return nil | |||
} | |||
oldHeap = h.heap | |||
h.heap = make(sortHeap, 0, 65536) | |||
h.heap = make(sortHeap, 0, sortHeapCapacity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to allocate a new slice for heap
? Can we reuse the previous one, eg: h.heap = h.heap[:0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Flushing the heap to disk is done in a separate goroutine, so we need to keep the original underlying array intact until it's been flushed.
/run-kafka-tests |
/lgtm |
/lgtm |
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: c9bafa6
|
/run-integration-tests |
/run-leak-tests |
/run-unit-tests |
/run-integration-tests |
/run-unit-tests |
/run-kafka-tests |
/run-integration-tests |
/run-unit-tests |
/merge |
/run-unit-tests |
Codecov Report
@@ Coverage Diff @@
## master #1854 +/- ##
================================================
+ Coverage 53.4083% 53.7992% +0.3908%
================================================
Files 154 158 +4
Lines 16166 16385 +219
================================================
+ Hits 8634 8815 +181
- Misses 6608 6616 +8
- Partials 924 954 +30 |
In response to a cherrypick label: new pull request created: #1862. |
In response to a cherrypick label: new pull request created: #1863. |
What problem does this PR solve?
ref: #1853
What is changed and how it works?
Since the access ofh.heap
is not concurrent, we can use the sameslice
The heap will be used in an async pool. We choose a conservative initialize size for sort heap slice.
1GB
?Check List
Tests
Release note