Skip to content

Reduce lock contention on series creation and del #1105

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 1 commit into from
Nov 6, 2018

Conversation

gouthamve
Copy link
Contributor

cortex_ingester_memory_series_removed_total might never be created if a user's series' never expire. Also, this reduces the lock contention around the metrics.

@tomwilkie
Copy link
Contributor

LGTM!

@bboreham
Copy link
Contributor

bboreham commented Nov 1, 2018

Maybe explain a bit how this works, for people who haven't studied Prometheus' client-go internals?
You are caching access to a "sub-counter", something like that?

@bboreham
Copy link
Contributor

bboreham commented Nov 1, 2018

Is this worth doing in similar cases, e.g. dynamoQueryRetryCount.WithLabelValues("BatchWrite") ?

@gouthamve
Copy link
Contributor Author

Yes. When we do WithLabelValues a lock is taken to lookup the right counter. We should cache is as much as possible, specially in cases where there are tons of lookups.

Further, when we just call WithLabelValues() without an Inc(), the counter is created for those values and is set to 0.

@tomwilkie tomwilkie merged commit cfffbfd into cortexproject:master Nov 6, 2018
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.

3 participants