Skip to content

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 a team, grafanabot and stevesg 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
@colega colega force-pushed the use-batchappender-batchseriesrefs- branch from eabfd1a to 17810a8 Compare March 31, 2025 15:35
@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
@github-actions
Copy link
Contributor

Thank you for your contribution. This pull request has been marked as stale because it has had no activity in the last 150 days. It will be closed in 30 days if there is no further activity. If you need more time, you can add a comment to the PR.

@github-actions github-actions bot added the stale label Aug 30, 2025
@colega colega closed this Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant