-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Streaming postings decoding leads to OOMs #6434
Comments
Is it caused by #6303? I feel the old format will have the same problem? |
I believe it was introduced by #6303. With the old format we decode one posting fully at a time, and we recycle the snappy decoder. With the streaming decoding we keep all decoders open until everything is merged, or at least that's how I understand it. Since we open one decoding reader per posting, for a matcher like I think that with the query above, decoding postings fully has a lower footprint than allocating buffers for decoders, so we end up being worse off. |
Thanks for the report. Let me try to write an optimized routine. It should be pretty straightforward given that we have preallocated []byte slices. |
I think a simple fix would be to try to estimate the block size instead of opting to use the default block size which is 65KiB. The only problem is that reader size needs to be passed to Creating a new input buffer seems to be unavoidable because in Snappy there can be references to uncompressed data so we need to save the last bytes of uncompressed data. |
Hi @fpetkovski, have you tested latest Thanos with #6475, does this pr fix the OOM kill issue? |
We haven't had a chance to test this yet, but I will report back if we see more OOMs once we upgrade. |
Object Storage Provider: GCS
What happened:
We have certain queries that have very high postings cardinality, like:
The streaming postings decoding seems to hold on to one snappy decoder for each posting, so for the
container
andpod
labels we end up with a huge amount of open decoders even before we start the merge.This lead to stores OOMing instantly because each snappy reader uses a 64KB buffer.
What you expected to happen:
I would like to have some mechanism for a more controlled memory management. Maybe we should decide on the strategy based on the size of the compressed data. Alternatively we can decide based on the number of keys.
How to reproduce it (as minimally and precisely as possible):
The query above could be sufficient.
Anything else we need to know:
Screenshot from a small staging environment when running the query

The text was updated successfully, but these errors were encountered: