Memory Check: Check and Free memory on cluster's nodes

The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.

Summary:

Check all nodes of the cluster to get current memory usage

# for node in $(asinfo -v "services" | tr -d "values is rqtdc\n" | \
tr ';' '\n' | cut -d: -f1 | sort); do echo $node; \
ssh root@$node "free -m"; ps -e -orss=,size=,args= | sort -b -n | \
tail -n 5; echo;echo; done

Sample Output:

10.65.18.101
total used free shared buffers cached
Mem: 48257 48031 226 0 94 33330
-/+ buffers/cache: 14605 33652
Swap: 24199 0 24199
4908 884 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
4920 3436 hald
7268 4244 /usr/bin/python /usr/bin/asmonitor
7524 4424 /usr/bin/python /usr/bin/asmonitor
29224892 13881320 /usr/bin/asd

Summary:

If memory is running low, free up some memory from cache

# for node in $(asinfo -v "services" | tr -d "values is rqtdc\n" | \
tr ';' '\n' | cut -d: -f1 | sort); do echo $node; \
ssh root@$node "free -m ; sync ; echo 3 | tee /proc/sys/vm/drop_caches; \
free -m"; ps -e -orss=,size=,args= | sort -b -n | tail -n 5; echo;echo; done

Sample Output:

10.65.18.101
total used free shared buffers cached
Mem: 48257 33106 15151 0 2 18923
-/+ buffers/cache: 14180 34077
Swap: 24199 0 24199
3
total used free shared buffers cached
Mem: 48257 33078 15178 0 0 18898
-/+ buffers/cache: 14179 34078
Swap: 24199 0 24199
4908 884 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
4920 3436 hald
7268 4244 /usr/bin/python /usr/bin/asmonitor
7524 4424 /usr/bin/python /usr/bin/asmonitor
29229404 13881320 /usr/bin/asd