Skip to content

Make multilevel cache backfilling async #5661

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

Merged
merged 6 commits into from
Nov 21, 2023

Conversation

yeya24
Copy link
Contributor

@yeya24 yeya24 commented Nov 20, 2023

What this PR does:

This change changes multilevel cache backfilling from sync operation to async operation.

Rather than waiting for cache backfilling requests to finish, it now use the async operation processor https://github.com/thanos-io/thanos/blob/main/pkg/cacheutil/async_op.go#L10 to backfill in an async way.

Backfilling functions will be added into a Golang channel with a configured size. And an amount of workers pull jobs from the channel and backfills to cache.

Since the channel size is limited, if an operation cannot enqueue, it will be discarded and we increment a metric called cortex_store_multilevel_index_cache_backfill_dropped_items_total. It should be fine to discard the backfill operation to prevent high load. As long as the same key is requested by user, the cache can be backfilled eventually.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@yeya24
Copy link
Contributor Author

yeya24 commented Nov 20, 2023

Let's wait for thanos-io/thanos#6908 to avoid duplicating too much code

Signed-off-by: Ben Ye <[email protected]>
@yeya24 yeya24 requested a review from alanprot November 20, 2023 22:15
@yeya24 yeya24 merged commit 72ba1d5 into cortexproject:master Nov 21, 2023
@yeya24 yeya24 deleted the async-backfilling branch November 21, 2023 23:44
@yeya24 yeya24 mentioned this pull request Nov 22, 2023
3 tasks
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.

2 participants