BrightID-Node icon indicating copy to clipboard operation
BrightID-Node copied to clipboard

Improve memory usage of arangodb process

Open abramsymons opened this issue 3 years ago • 3 comments

@TripleSpeeder reported that arangodb is using around half of 32GB dappnode memory.

screenshot-snapshot raintank io-2021 03 03-14_16_59

It seems we have some sort of problem in garbage collection that is related to new transnational mechanism we are using in latest release to cache queries and speed up things when there are high number of queries that should run. Node one is also using around half of its 4G memory.

abramsymons avatar Mar 03 '21 10:03 abramsymons

I think this is not a bug, but rather expected behaviour. After reading https://www.arangodb.com/docs/stable/tutorials-reduce-memory-footprint.html and especially https://www.arangodb.com/docs/stable/programs-arangod-rocksdb.html#write-buffers it looks like the RAM usage is mostly rocksdb write buffers.

By default rocksdb.total-write-buffer-size is calculated as (system RAM size - 2GiB) * 0.5. With 32GB on my machine this results in the observed 15GB RAM used.

I'm extending the DappNode package setup to allow setting additional parameters to running arangodb, allowing to modify the RAM usage behaviour.

TripleSpeeder avatar Mar 10 '21 09:03 TripleSpeeder

Running with --rocksdb.total-write-buffer-size 4294967296 (4GB) does not show any difference in RAM usage. Attached image shows RAM usage before and after restart with this option. image I continue exploring other options.

TripleSpeeder avatar Mar 11 '21 07:03 TripleSpeeder

Looks like the read cache is using up most of the space. Limiting read cache to 2Gigabyte with --rocksdb.block-cache-size 2000000000 --rocksdb.enforce-block-cache-size-limit true results in overal memory usage capped at ~4GB: image

TripleSpeeder avatar Mar 11 '21 15:03 TripleSpeeder