etsy/mctop

Name: mctop

Owner: Etsy, Inc.

Description: a top like tool for inspecting memcache key values in realtime

Created: 2012-12-13 20:46:34.0

Updated: 2017-12-12 08:14:59.0

Pushed: 2017-12-03 02:35:29.0

Homepage: null

Size: 295

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

mctop is an Archived Prjoect

mctop is no longer actively maintained. Your mileage with patches may vary.

mctop

Inspired by “top”, mctop passively sniffs the network traffic passing in and out of a server's network interface and tracks the keys responding to memcache get commands. The output is presented on the terminal and allows sorting by total calls, requests/sec and bandwidth.

You can read more detail about why this tool evovled over on our code as craft blog.

mctop depends on the ruby-pcap gem, if you don't have this installed you'll need to ensure you have the development pcap libraries (libpcap-devel package on most linux distros) to build the native gem.

How it works

mctop sniffs network traffic collecting memcache VALUE responses and calculates from traffic statistics for each key seen. It currently reports on the following metrics per key:

Getting it running

the quickest way to get it running is to:

Command line options
Usage: mctop [options]
    -i, --interface=NIC              Network interface to sniff (required)
    -p, --port=PORT                  Network port to sniff on (default 11211)
        --host=HOST                  Network host to sniff on (default all)
    -d, --discard=THRESH             Discard keys with request/sec rate below THRESH
    -r, --refresh=MS                 Refresh the stats display every MS milliseconds
    -h, --help                       Show usage info
User interface commands

The following key commands are available in the console UI:

Status bar

The following details are displayed in the status bar

Changelog
Known issues / Gotchas
ruby-pcap drops packets at high volume

from my testing the ruby-pcap native interface to libpcap struggles to keep up with high packet rates (in what we see on a production memcache instance) you can keep an eye on the packets recv/drop and loss percentage on the status bar at the bottom of the UI to get an idea of the packet

No binary protocol support

There is currently no support for the binary protocol. However, if someone is using it and would like to submit a patch, it would be welcome.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.