After deleting all records from a namespace using a Lua script, some of the RAM remains in use. This has continued to grow over multiple cycles of inserting and deleting the data, up to 28.77% of the cluster RAM with no records currently. (Note that this is a RAM-only cluster.)
Any idea what could be using this RAM and how to free it?
It does seem the usage is slowly shrinking. The last node in that list, for example, is down to 31.943 GB from 32.220 GB. But it’s very slow. Too slow.
If you are running an enterprise release, the primary index is stored in shared memory and grows in 1GiB arenas. This memory isn’t released back to the OS unless you issue a coldstart.
If you run:
ipcs -m
The memory with keys beginning with 0xae are Aerospike primary index arena allocations.
Thanks. I inserted a few million values and the RAM use didn’t increase, so this seems confirmed.
Still, it’s not great from a reporting perspective. Is there any way to see the amount of memory actually in use, as opposed to memory that is simply being held by the process?
Sorry for my confusion, after a code inspection, that metric is “memory actually in use”. So we are back to your original question of why it didn’t go to 0.
So it does seem the memory is just being used by the index. How can I quickly free up the memory from the index? Do I need to drop and recreate the index? I suppose I could write an aql script to do that, if necessary.
UPDATE: I tried dropping the index. Unfortunately it made the cluster unresponsive - half the nodes were showing as offline (intermittently) and asadm returned nothing. After 5-10 minutes it did come back, with much lower usage - but it’s still using 168.06 GB (10.98%). So maybe even dropping the indices isn’t a solution.
UPDATE2: One of the two indices still exists. I guess the cluster just failed to delete it. So I dropped it again, and this time it stuck. Next time I’ll have to make sure to drop indices one at a time. At least the memory use dropped quickly and within a minute had hit zero.
It sounds like you are using secondary indexes. If this happens again, you can speed up garbage collection with the following commands:
Increase gc-max-units to increase the amount of memory cleaned up by garbage collection:
asinfo -v “set-config:context=namespace;id=;gc-max-units=10000”
Decrease the time between garbage collection sessions:
asinfo -v “set-config:context=namespace;id=;gc-period=500”
Thanks for the info. For now I think my best bet is to just drop and recreate the indices, since I want the namespace emptied as quickly as possible between test runs.
Ideally Aerospike would provide support for truncating namespaces.
The version I’m currently testing against is Community Edition 3.6.0.
Will you please check that CE version again and provide it?
Our Aerospike Management Console (AMC) has a 3.6.0 version (the latest is 3.6.1), but the Aerospike Server Community Edition’s latest version is 3.5.14.