Memcached

Memcached

This template allows you to monitor the performance of Memcached installed on a Linux machine by using Perl scripts.

Note: This template was created on Memcached version 1.4.13.

Prerequisites: SSH and Perl installed on the target server. SNMP installed on the target server and permission to monitor the memcached process.

Credentials: User under which Memcached was installed.

Each Linux/Unix monitor uses the same argument structure. For example:

perl ${SCRIPT} 11211

where:

11211 - TCP port used by memcached .

Note: You must specify the correct arguments for each monitored component in the Script Arguments field. If you fail to do this, the monitor will return with a status error of "Undefined."

Components Monitors

General statistic

This monitor returns general statistics. The returned values are as follows:

Threads - This component returns the number of worker threads requested.

Current connections- This component returns the number of opened connections.

Total connections- This component returns the total number of connections opened since the server started running.

Connection structures- This component returns the number of internal connection handles currently held by the server. Compare this monitor to Current connections. Memcached should have about 10% more Connection structures than Current connections.

Current items- This component returns the current number of items currently stored.

Total items- This component returns the total number of items stored since the server started.

Used for caching- This component returns the current number of MB to store items.

Evictions - This component returns the number of valid items removed from the cache to free memory for new items. This value should be zero at all times.

Denied connections- This component returns the number of denied connection attempts because Mmemcached reached its configured connection limit. This monitor should zero at all times.

Cache usage ratio- This component returns the cache usage ratio. It is calculated by the following formula: used_for_caching*(limit_maxbytes/100.0). This value should be as low as possible.

Requests

This monitor returns the requests statistic. The returned value are as follows:

Get - This component returns the cumulative number of retrieval requests.

Set - This component returns the cumulative number of storage requests.

Flush - This component returns the cumulative number of flush requests.

Touch - This component returns the cumulative number of touch requests.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of requests in the Message field while the Statistic field will only show the new number of requests since the last polling period.

Operations statistic

This monitor returns the operations statistic. The returned values are as follows:

Get hits - This component returns the number of keys that have been requested and found to be present.

Get misses - This component returns the number of items that have been requested and not found to be present.

Delete hits - This component returns the number of deletion requests resulting in an item being removed.

Delete misses- This component returns the number of deletion requests for missing keys.

Incremental hits- This component returns the number of successful incremental requests. Incremental is a replace adding one to the stored value and failing if no value is stored.

Incremental misses- This component returns the number of incremental requests against missing keys. Incremental is a replace adding one to the stored value and failing if no value is stored.

Decremental hits- This component returns the number of successful decremental requests. The decremental command decreases a stored (integer) value by one.

Decremental misses- This component returns the number of decremental requests against missing keys. The decremental command decreases a stored (integer) value by one.

CAS hits - This component returns the number of successful CAS requests. The CAS command is Memcached's anti-locking command.

CAS misses - This component returns the number of CAS requests against missing keys. The CAS command is Memcached's anti-locking command.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of requests in the Message field while the Statistic field will show only new number of requests since the last polling period.

Operations ratio

This monitor returns the operations ratio statistic. The returned values are as follows:

Get hit ratio- This component returns the get hit ratio. It is calculated by the following formula: get_hits/(get_hits+get_misses)*100.0. This value should be as high as possible.

Delete hit ratio- This component returns the delete hit ratio. It is calculated by the following formula: delete_hits/(delete_hits+delete_misses)*100.0. This value should be as high as possible.

Incremental hit ratio- This component returns the incremental hit ratio. Incremental is a replace adding one to the stored value and failing if no value is stored. It is calculated by the following formula: incr_hits/(incr_hits+incr_misses)*100.0. This value should be as high as possible.

Decremental hit ratio- This component returns the decremental hit ratio. The decremental command decreases a stored (integer) value by one. It is calculated by the following formula: decr_hits/(decr_hits+decr_misses)*100.0. This value should be as high as possible.

CAS hit ratio- This component returns the CAS hit ratio. The CAS command is Memcached's anti-locking command. It is calculated by the following formula: cas_hits/(cas_hits+cas_misses)*100.0. This value should be as high as possible.

Network statistic

This monitor returns network statistics. The returned values are as follows:

Received - This component returns the total number of kBs received from the network by this server.

Sent - This component returns the total number of kBs sent to the network by this server.

Note: By default, this monitor has the Count statistic as difference box checked. It will show the total number of kB in the Message field while the Statistic field will show only new number of kBs since the last polling period.

Slabs statistic

This monitor returns slabs statistics. The returned values are as follows:

Active slabs- This component returns the total number of slab classes allocated.

Memory allocated- This component returns the total amount of memory allocated to slab pages.

Memcached TCP Port Monitor

This component monitor tests the ability of a memcached service to accept incoming sessions. By default, it monitors TCP port 11211.

Process: memcached

This monitor returns CPU and memory usage of the memcached server process.

Portions of this document were originally created by and are excerpted from the following sources:

The PHP Group, “Memcache”, Copyright Copyright 2001-2012 The PHP Group. 
All rights reserved.  Available at
http://www.php.net/manual/en/book.memcache.php.