Memcached Monitoring

Proactively monitor the health and performance of business-critical Memcached servers.

Memcached is a free and open-source, general purpose distributed memory caching system. Analyze the performance of your Memcached server and take informed troubleshooting descisions by keeping track of critical metrics.

This document details how to configure the Memcached plugin and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of Memcached servers.

Memcached performance monitoring metrics:

Bytes

"bytes" metric counts and records the total number of bytes currently used by the server to store items. I.e., the number of bytes currently used for caching items.

Bytes read

"bytes_read" metric counts and records the total number of bytes read by the server from network.

Bytes written

The total number of bytes sent over the network by the server is recorded using the metric "bytes_written". It has no bearing or connection on the total size of the data you're storing.

Current connections

The metric "connections_current" records the total number of connected clients. If this value is very high or low, then the chances of system failure are high. Ideally, the number of open connections to the Memcached server should be the same value on all servers.

Total connections

The metric "connections_total" records the total number of connections opened since the server started running. Ideally, the total number of connections should be lesser than the total number of get/set commands.

Threads

Get the total number of worker threads requested with the metric "threads". This metric represents the total number of threads used to process incoming requests. Ideally, this should'nt be higher than the totala number of CPU cores on the server.

Evictions

Use the metric "evictions" and get the total number of evictions made in your Memcached server. An eviction occurs when an object that has time to live is removed from the cache because a brand new item needs to be allocated.

Limit maximum bytes

The total number of bytes the server is permitted to use for storage is recorded using the metric "limit_maxbytes".

How it works?

  • Log-in to your Site24x7 account. Sign up here if you don't have one.
  • Download and install the latest version of Site24x7 Linux Agent
  • Install the Memcached plugin
  • The agent will execute the Memcached plugin and push the data to the Site24x7 server

Prerequisites:

  • Site24x7 Memcache plugin uses "python-memcache" module to get the performance metrics of Memcached server

Note: Site24x7 Linux agent will automatically try to install "python-memcache" using the "pip" command. If the installations fails, users can manually install the module following the steps mentioned under the section "How to install memcache?".

How to install memcache?

Memcached plugin installation:

  • Create a directory with the name "memcached", under Site24x7 Linux Agent plugin directory - /opt/site24x7/monagent/plugins/
  • Download the file "memcached.py" from our GitHub repository and place it under the "memcached" directory
  • Commands to perform the above step:
  • cd /opt/site24x7/monagent/plugins/
    mkdir memcached
    cd memcached
    wget https://raw.githubusercontent.com/site24x7/plugins/master/memcached/memcached.py
  • Once the plugin file is downloaded, the agent will mark it up in the next data collection and you can view it in Site24x7 client

Memcached plugin configuration:

  • By default, the plugin will monitor Memcached instance that is configured on "localhost"
  • The default python path given in the plugin script is #!/usr/bin/python. If you wish to provide an alternate python path, replace the existing one preceded by the shebang character "#!".
  • In order to change the monitoring configuration, go to plugins directory and edit the "#Config Section:" in memcached.py file
  • Memcached plugin file location - /opt/site24x7agent/monagent/plugins/memcached/memcached.py

    #Config Section:
    MEMCACHE_HOST='127.0.0.1'
    MEMCACHE_PORT=11211

Monitoring additional metrics:

  • To monitor additional metrics, edit the "memcached.py" file and add the new metrics that need monitoring
  • Increment the plugin version value in the file "memcached.py" to view the newly added metrics ( For e.g. change the default plugin version from PLUGIN_VERSION = "1" to "PLUGIN_VERSION = "2")

Related plugins:

  • ActiveMQ plugin - Monitor performance metrics of your ActiveMQ databases
  • MongoDB plugin - Monitor performance metrics of your MongoDB databases
  • Twilio plugin - Analyze performance of your Twilio server
  • Nagios plugin - Execute thousands of Nagios plugins in Site24x7 without the need of running a Nagios server
  • Out-of-the-box plugins - Monitor your entire app stack with our extensive list of integrations
  • Create custom plugins - Create custom Linux and Windows plugins and monitor custom attributes
Trusted

World's leading companies

Client

Don't have a Site24x7 account? Sign up now!