Skip to content

Use BatchSeriesRefs() to create incoming series in one batch instead of one by one #11019

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

colega
Copy link
Contributor

@colega colega commented Mar 26, 2025

Overview

This is a proof-of-concept built on top of grafana/mimir-prometheus#860

It leverages the new BatchAppender that has a BatchSeriesRefs method that can create multiple series in a single call.

Background

Whenever a tenant has lots of series churn, or especially when ingesters start receiving series after a while (after startup or going out of read only mode), we see lots of mutex contention on MemPostings as hundreds and thousands of calls to MemPostings.Add occur, each one trying to acquire the lock.

I tried optimizing that with no luck in the past, this is yet another try.

This leverages a new method in headAppender that will allow us creating all series at once.

@colega colega requested review from stevesg, grafanabot and a team as code owners March 26, 2025 17:15
@colega colega marked this pull request as draft March 26, 2025 17:16
@colega colega force-pushed the use-batchappender-batchseriesrefs- branch 3 times, most recently from c9202f1 to 50b067c Compare March 31, 2025 13:54
@colega colega closed this Mar 31, 2025
@colega colega reopened this Mar 31, 2025
@colega colega force-pushed the use-batchappender-batchseriesrefs- branch 2 times, most recently from 939ce46 to eabfd1a Compare March 31, 2025 15:15
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega force-pushed the use-batchappender-batchseriesrefs- branch from eabfd1a to 17810a8 Compare March 31, 2025 15:35
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
@colega colega changed the title Use BatchAppender.BatchSeriesRefs() Use BatchSeriesRefs() to create incoming series in one batch instead of one by one Apr 1, 2025
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.

1 participant