Check Memory Usage of Memcached

From Brian Nelson Ramblings
Jump to: navigation, search

Check How much Memory Usage Memcached is Using

Are you having issues with memcached crashing? You can use the following command to check the via port or unix socket.

echo; read -p "Socket(Enter if using IP): " _ADDRESS_; if [ -z $_ADDRESS_ ]; then _OPT_=; read -p "IP Address: " _ADDRESS_; \
read -p "PORT: " _PORT_; else _OPT_='-U'; _PORT_=; fi; echo -e "\nMemcached is $(echo "stats slabs" | nc $_OPT_ $_ADDRESS_ \
$_PORT_ > ~/.tmpMemcachedLogFile; echo "scale=3;100*$(awk '/used_chunks/ {sum+=$NF} END{print sum}' \
 ~/.tmpMemcachedLogFile)/$(awk '/total_chunks/ {sum+=$NF} END{print sum}' ~/.tmpMemcachedLogFile)" | bc)% filled\n"; \
 rm ~/.tmpMemcachedLogFile

memcache memory usage

Additional Articles

* Memcached Monitor Tool
* Setup Multi Instance Memcache
* Check if Memcached is Running
* Flush Your Memcached Instance