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.

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.

Prerequisites

  • Ensure the 'python-memcached' module is installed to get the performance metrics from the Memcached server. The Site24x7 Linux monitoring agent will automatically install the 'python-memcached' module. If the installation fails, refer the following section to install it manually.
  • Our Linux server monitoring agent should be installed in the server where you plan to run the plugin.
  • While adding a plugin, the plugin name and its folder name should be identical.
  • Execute the following command in your server to install the python requests module sudo pip install python-memcached

Installing pip:

  • Use "pip" to install requests module
    Note: pip is a package management system that is used to install and manage software packages written in Python.
  • For CentOS, Fedora, RHEL:
    yum install python-devel
    yum install python-pip (or)
    easy_install pip
  • For Debian, Ubuntu:
    apt-get -y install python-pip

Plugin Installation

  • Download and install the latest version of the Site24x7 Linux agent in the server where you plan to run the plugin. If it is installed successfully, you will see a Linux server monitor in the Site24x7 Control Panel. This confirms that the agent is able to communicate with our data center.
  • Download the file memcached.py file from our GitHub repository.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/memcached/memcached.py
  • By default, the plugin will monitor the Memcached instance that is configured on 'localhost'. To change the configuration, edit the "#Config Section:" in 'memcached.py' file.
    #Config Section:
    MEMCACHE_HOST='127.0.0.1'
    MEMCACHE_PORT=11211
  • Create a folder with the name 'memcached', under Site24x7 Linux agent plugin directory - '/opt/site24x7/monagent/plugins/' and place the 'memcached.py' under '/opt/site24x7/monagent/plugins/memcached/'
The agent will automatically execute the plugin within five minutes and send performance data to the Site24x7 data center.

View Data in the Site24x7 Web Client

  1. Log in to Site24x7 and go to Server > Plugins > Name of Plugin Monitor.
  2. You will be able to view the performance charts on the various metrics for your Memcached server.

Plugin Contribution

Feel free to contribute to our existing plugin and come up with suggestions or feedback on our Community.

Other Plugin Integrations