-
Notifications
You must be signed in to change notification settings - Fork 543
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
kafka replay speed: upstream push sharding #9454
Merged
dimitarvdimitrov
merged 3 commits into
main
from
dimitar/ingest/replay-speed/sharding-pushers
Sep 30, 2024
Merged
kafka replay speed: upstream push sharding #9454
dimitarvdimitrov
merged 3 commits into
main
from
dimitar/ingest/replay-speed/sharding-pushers
Sep 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: gotjosh <[email protected]> Signed-off-by: Dimitar Dimitrov <[email protected]>
tacole02
approved these changes
Sep 27, 2024
gotjosh
approved these changes
Sep 30, 2024
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.
LGTM
Co-authored-by: gotjosh <[email protected]>
Co-Authored-By: Dimitar Dimitrov <[email protected]>
dimitarvdimitrov
deleted the
dimitar/ingest/replay-speed/sharding-pushers
branch
September 30, 2024 16:29
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-9454-to-r293 origin/r293
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 456bbfde5745fcb711cee460d208c4e073aa5974
# Push it to GitHub
git push --set-upstream origin backport-9454-to-r293
git switch main
# Remove the local backport branch
git branch -D backport-9454-to-r293 Then, create a pull request where the |
grafanabot
pushed a commit
that referenced
this pull request
Sep 30, 2024
* kafka replay speed: upstream push sharding Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: gotjosh <[email protected]> Signed-off-by: Dimitar Dimitrov <[email protected]> * Apply suggestions from code review Co-authored-by: gotjosh <[email protected]> --------- Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: gotjosh <[email protected]> (cherry picked from commit 456bbfd)
gotjosh
pushed a commit
that referenced
this pull request
Sep 30, 2024
* kafka replay speed: upstream push sharding Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: gotjosh <[email protected]> Signed-off-by: Dimitar Dimitrov <[email protected]> * Apply suggestions from code review Co-authored-by: gotjosh <[email protected]> --------- Signed-off-by: Dimitar Dimitrov <[email protected]> Co-authored-by: gotjosh <[email protected]> (cherry picked from commit 456bbfd) Co-authored-by: Dimitar Dimitrov <[email protected]>
4 tasks
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This is the third of series of PRs to upstream the code for improving Kafka replay speed in the ingester.
In this PR we upstream push sharding. The basic idea is that instead of ingesting each record from Kafka sequentially, we can shard each timeseries and ingest them in parallel.
I'm submitting the PR, but the work was done jointly by @gotjosh and myself
Basic breakdown
pusherConsumer
parallelStoragePusher
parallelStoragePusher
parallelStorageShards
. This ensures each tenant's data is processed independently and in parallel.a) It provides a complete unit (batch of records) that can be retried if necessary.
b) It ensures all data from the batch is processed before moving to the next batch.
parallelStorageShards
(tenant, WriteRequest.Source)
pairbatchingQueue
Error Handling:
Due to the concurrent nature of pushing, it is hard to immediately abort fetching. As a result errors are delayed and we may continue ingesting for a little bit until we detect the error.
The error handling has been extracted from
pusherConsumer
and implemented in theparallelStoragePusher
andsequentialStoragePusher
. This approach allows errors to be handled closer to their source. Instead of propagating lists of errors, only retriable critical errors that require aborting consumption are propagated. This simplifies error management and allows for more targeted retry strategies.Cosmetic Changes
In
pusherConsumer.Consume
, the two goroutines for unmarshaling and ingestion have been inlined into the Consume function. There shouldn't be any functional changes there.Metrics changes
We renamed
cortex_ingest_storage_reader_processing_time_seconds
tocortex_ingest_storage_reader_records_processing_time_seconds
to be more consistent.Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.