Difference between revisions of "Check Memory Usage of Memcached"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==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. e...")
(No difference)

Revision as of 22:15, 18 January 2014

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