-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Getting "query processing would load too many samples" error for simple count(metric) query #7281
Comments
This all is as expected, if you try to have an intermediate range vector that has over 50M samples the limit is protecting you as designed. |
The problem as I see it is that it needs to load entire intermediate range vector before processing it, where range here is really the entire input window :-( How difficult (or even possible) would it be to avoid this limitation/step? |
That'd be a significant rewrite of PromQL, which would likely increase memory and cpu usage for common queries which'd be kinda self-defeating. If you need to work with high-cardinality series like this you should use recording rules. |
Thanks for reply. |
Looks like there's nothing to do here. |
Hrm, I'd disagree @brian-brazil. While it would require significant rewrite of PromQL, it doesn't mean its not an issue. Maybe someone looking to rewrite PromQL in the future could look at fixing this as well. We're not doing
I would see this as a bug in PromQL with not-as-easy-as-it-looks but not something to be closed. |
I don't see how this can be classed as bug, this is working exactly as designed. This query does attempt to have more than 50M samples in memory and it is correctly stopped. |
This can be an enhancement in the way we count series. If it's worth it, we can have a special case for |
That wouldn't be correct as it wouldn't handle gaps or staleness correctly, and we already process only a sliding window of one series at a time when evaluating instant vectors. Note that |
Please let's not focus on |
Exactly. |
If you play with such cardinality you are probably counting events and you should look at something else than Prometheus to compute that. |
Not necessarily. We frequently see it for basic metrics, like container CPU/memory across all containers in a datacenter. It's not uncommon to have tens of thousands of containers. |
Yeah, the use case is fine - though you can't expect things to work the same way without having to do any additional work with such high cardinality compared to doing the same with low cardinality. |
@gouthamve please remove the bug label. This works exactly as designed in #4414. That limit works for many Prometheus users. What would be your proposal to change the current behavior? cc @tomwilkie and @cstyan who worked on setting the limit in the original issue. |
By rereading the issue I know understand it better & understand it, discard my previous message. |
I have been looking at the code and this is a bug |
Can you expand? The math indicates that there's just too much data. |
For instance selection yes But we could do better for ranges: #7285 |
We have just realized that this also depends on resolution (step), so increasing step interval decreases number of needed samples, since PromQL only needs one sample per step per series. |
#'7307 should fix the incorrect accounting. I think we can close now? |
We looked at this in the bug scrub, and the bug discovered was fixed in #7307. |
What did you do? Run
count(metric)
for metric with high number of series (200k) over 1h range in Prometheus UI.What did you expect to see? Result.
What did you see instead? Under which circumstances? Instant query returns 208040, but trying to create graph (using Prometheus Graph tab) for range as low as 10 minutes fails with error saying
Error executing query: query processing would load too many samples into memory in query execution
.Running Prometheus version: 2.18.1, ecee9c8, with query.max-samples=50000000.
The text was updated successfully, but these errors were encountered: