-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Decompression uses too much memory #1239
Comments
I've tried two different approaches to reduce the memory but both of them aren't working. Attempt 1 - PR #1247 Reuse the original byte slice (the one read from the table). The problem with this approach is that the sst is mmap and if the slice of bytes read from the table is put into the sync pool, we might end up modifying the original contents of the file. This was seen in #1247 . Attempt 2 - PR #1308 . Attempt to reuse the byte slice after the block iterator is done processing it. This also has some strange issue which I haven't been able to figure out. In simple terms, the contents of block change if the slices are reused. This is definitely an issue with the implementation in #1308 but I haven't been able to fix it. I've spent significant time trying to debug this but haven't found the issue yet. |
This commit uses a sync pool to hold the decompression buffers. A buffer is added to the pool only if it was used for decompression. We don't want to put buffers that were not used for decompression because these buffers are read from mmaped SST files and any changes to these buffers would lead to a segfault. Fixes #1239
This commit uses a sync pool to hold the decompression buffers. A buffer is added to the pool only if it was used for decompression. We don't want to put buffers that were not used for decompression because these buffers are read from mmaped SST files and any changes to these buffers would lead to a segfault. Fixes dgraph-io/badger#1239
This commit uses a sync pool to hold the decompression buffers. A buffer is added to the pool only if it was used for decompression. We don't want to put buffers that were not used for decompression because these buffers are read from mmaped SST files and any changes to these buffers would lead to a segfault. Fixes dgraph-io/badger#1239
Badger uses compression to reduce disk space. When the block are decompressed, it takes up too much memory.
badger/table/table.go
Lines 625 to 629 in 5b4c0a6
The crux of the problem is that the decompression call allocates new block every time we want to decompress an existing block. An ideal fix here would be to find a way to reuses the blocks of memory.
Taken from chat: https://dgraph.slack.com/archives/C13LH03RR/p1583223673220200?thread_ts=1583216894.212400&cid=C13LH03RR
The text was updated successfully, but these errors were encountered: