References > Template Reference > Memcached

Memcached

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

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.

  • 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."
  • On some Linux distributions, there is no "nc" command. The "netcat" command is used instead. This can result in a situation where all the components except "Memcached TCP Port Monitor" and "Process: memcached" show "Fail" with the following error: "nc not found." In some cases, you may need to change "nc" to "netcat" to avoid this error.

Monitored Components

For details on monitors, see SAM Component Monitor Types.

General statistic

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

  • Used 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 MB – 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.
  • Memcache 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:

  • Retrieval requests – This component returns the cumulative number of retrieval requests.
  • Storage requests – This component returns the cumulative number of storage requests.
  • Flush requests – This component returns the cumulative number of flush requests.
  • Touch requests – This component returns the cumulative number of touch requests.

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.

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 kB – This component returns the total number of kBs received from the network by this server.
  • Sent kB – This component returns the total number of kBs sent to the network by this server.

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 slab classes – This component returns the total number of slab classes allocated.
  • Allocated memory to slab pages – 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.