-
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
Potential memory leak in oracle #1238
Comments
@popbones if you're running 8 transactions parallelly, you will end up with multiple conflicts. I don't completely understand which part of your program is supposed to run parallelly, but if the parallelism is to insert data into badger faster, you might want to use a single Also, it is expensive to create a transaction again and again. Every time a transaction is created, we wait for some (worst case all) of the preceeeding transactions to complete. |
Thanks for the reply. The program performs the Could you please elaborate on the multiple conflicts part in your comment. I was under the impression the transactions are concurrent safe. Are they not? |
We also have the same problem, several batchWriter that run in parallel. Any idea when #1198 will be merged? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Fixed via #1275 |
What version of Go are you using (
go version
)?What version of Badger are you using?
Does this issue reproduce with the latest master?
Not tested yet
What are the hardware specifications of the machine (RAM, OS, Disk)?
What did you do?
Basically we have a command line program that reads from a file and for each line we do a check and set operation using badger as our database.
The snippet for the check and set looks like this
This is all standard. But the program does try to do things in batch and concurrently (say 8 goroutine and 1000 keys per call). And we find for large input, say >100M records, the memory usage continues to grow and get an OOM if swap is not enabled (Tested on a EC2 box with about 30G of RAM).
The heap profile indicates the most of the space inuse is allocated in
newCommitTs
, https://github.com/dgraph-io/badger/blob/master/txn.go#L188 to be exact.What did you expect to see?
Memory should be released more promptly after the transaction has finished.
What did you see instead?
Memory continually to grow even many transactions have finished.
My thought
It seems to me commits map only get released when there's no more reference to the oracle according to https://github.com/dgraph-io/badger/blob/master/txn.go#L86
So in our case, since the concurrency, that rather unlikely to happen. So the commits map just hanged around way longer than it should.
The memory is way more stable when we run 1 goroutine but 8K keys per call.
The text was updated successfully, but these errors were encountered: