immudb
immudb copied to clipboard
Optimize memory footprint of immudb when using large number of entries per transaction
Running immudb with a large number of entries per transaction results in large demand for RAM.
How to reproduce
-
Start immudb with 20 480 entries per transaction setting.
-
Immudb requires 16GB of RAM to be run
-
Start immudb with 1024 entries per transaction setting
-
Immudb requires around 500 MB of RAM.
Acceptance criteria:
- immudb does not preallocate memory but allocates on demand
References:
Buffer: https://github.com/codenotary/immudb/blob/caddadad5e48a5cb7475e317a01d1aef91468ca9/embedded/store/immustore.go#L319
Where used: https://github.com/codenotary/immudb/blob/caddadad5e48a5cb7475e317a01d1aef91468ca9/embedded/store/immustore.go#L1041
It is copied to dynamically allocated buffer anyway: https://github.com/codenotary/immudb/blob/caddadad5e48a5cb7475e317a01d1aef91468ca9/embedded/store/immustore.go#L1118