Skip to content
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

perf: Re-introduce fixed size memory pool for bloom querier #13172

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Jun 7, 2024

What this PR does / why we need it:

This PR re-introduces the fixed size memory pool that was originally introduced with #13039 but reverted with #13162

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@chaudum chaudum force-pushed the chaudum/mempool branch 2 times, most recently from 2cc9507 to 9ee6b31 Compare June 10, 2024 09:10
@chaudum chaudum marked this pull request as ready for review June 10, 2024 09:10
@chaudum chaudum requested a review from a team as a code owner June 10, 2024 09:10
chaudum added 4 commits June 19, 2024 09:42
---

Revert "fix(regression):  reverts #13039 to prevent use-after-free corruptions (#13162)"

This reverts commit 41c5ee2.

Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
@@ -18,6 +23,7 @@ type Config struct {
BlocksCache BlocksCacheConfig `yaml:"blocks_cache"`
MetasCache cache.Config `yaml:"metas_cache"`
MetasLRUCache cache.EmbeddedCacheConfig `yaml:"metas_lru_cache"`
MemoryManagement MemoryManagementConfig `yaml:"memory_management" doc:"hidden"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly hide this config from the docs.

Copy link
Contributor

@salvacorts salvacorts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left a nit.

// While bloomStoreEntry implements the Store interface, this method must never
// be used directly and therefore can safely return nil.
func (b *bloomStoreEntry) Allocator() mempool.Allocator {
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think would be better to no having to satisfy the interface in this way. Maybe we can have

type StoreWithAllocator interface {
    Store
    Allocator() mempool.Allocator
}

Ans only BloomStore implements that.

Having said that, if we don't want to do this, I think we should rather panic here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I will add the interface.

Move `Allocatior()` function from base interface to "extended" store
interface, like it was done for `BloomMetrics()`.

Additionally renamed `Store` to `StoreBase` (which is implemented by all
stores, also the individual store entries) and `StoreWithMetrics` to
`Store`, because this is the main interface that is used.

Signed-off-by: Christian Haudum <[email protected]>
@chaudum chaudum merged commit 4117b6c into main Jun 20, 2024
60 checks passed
@chaudum chaudum deleted the chaudum/mempool branch June 20, 2024 10:05
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