aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
430 stars 199 forks source link

Massive amount of memory occupied by `newPartitionStatus` and `newNodePartitions` #421

Open chengc-sa opened 8 months ago

chengc-sa commented 8 months ago

We recently observed a huge memory difference between library v6.13.0 and v4.5.2, and we run a memory profiling, and found out that these two functions (newPartitionStatus and newNodePartitions) are taking up a lot of memory, is this expected and are these partition statuses fetched from server for each query request?

Screenshot 2023-11-02 at 2 51 37 PM
khaf commented 8 months ago

This is expected, due to the fact that the new Query/Scans are stateful and can be resumed and retried. These values are not fetched from the server. It's just that the latest information regarding what key from what node and partition was fetched and which partitions were done vs partially finished are kept in these data structures as the Scan/Query progresses.

The question is what the numbers in your columns represent. Are these still in memory, or just the total allocated and later released by the GC?

chengc-sa commented 8 months ago

This is expected, due to the fact that the new Query/Scans are stateful and can be resumed and retried. These values are not fetched from the server. It's just that the latest information regarding what key from what node and partition was fetched and which partitions were done vs partially finished are kept in these data structures as the Scan/Query progresses.

The question is what the numbers in your columns represent. Are these still in memory, or just the total allocated and later released by the GC?

Thanks for some clarifications! This is total allocated. Is there any way to disable this stateful query/scan? This is increasing our client-side memory usage from 1x to 2-3x just due to this

khaf commented 8 months ago

Unfortunately it is not, but if it's critical, we will discuss the feature in our product/engineering meeting.

chengc-sa commented 8 months ago

OK thanks!

khaf commented 8 months ago

Reopening to keep it in the ticket list.