Need help with memsniff?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

134 Stars 15 Forks Apache License 2.0 59 Commits 3 Opened issues


A tool for recording and displaying statistics on memcached traffic written in golang.

Services available


Need anything else?

Contributors list


Project StatusBuild StatusGo Report Card

Memsniff displays the busiest keys being retrieved from your memcache server. It has been inspired by the earlier mctop and memkeys tools.

Like its predecessors, memsniff listens to network traffic and identifies responses to

requests, and is usually run directly on a memcache server host.

You can see our announcement here.


Before building you'll need to have the libpcap library and headers installed.

On Redhat-based distributions:

# yum install libpcap-devel

Or on Debian-based distributions:

# apt-get update && apt-get install libpcap-dev

Memsniff uses the standard golang toolchain, which makes installation simple. Once you have the toolchain installed and

pointed to your working directory:
$ go get
$ go build

You will find a compiled binary at

, ready to be transferred to your Memcache hosts or packaged in your distribution's preferred format.


On most operating systems

requires superuser privileges to capture network traffic from an interface, which you specify with the
# memsniff -i eth0


for more command-line options. Once running a few more keys are active:
  • p
    - Pause the updating of the display. Press
    again to resume.
  • q
    - Exit


  • Support binary memcached protocol
  • Support additional operations beyond GET
  • Support alternate sorting methods
  • Create a stable report format for output to disk
  • Automatic logging to disk when specified conditions are met (e.g. aggregate or single key traffic exceeds a threshold)
  • Break out traffic by client IP
  • Supply build support for common package formats (
    , …)

Developing memsniff

Want to contribute? First have a look at

Running the tests

uses the standard Go testing framework:
$ go test ./...
? [no test files]
ok   0.067s

Data pipeline

  1. Raw packets are captured on the main thread from
    using GoPacket.
  2. Batches of raw packets are sent to the decode pool, where workers parse the memcached protocol looking for responses to
    requests. The key and size of the value returned are extracted into a response summary.
  3. Batches of response summaries are sent to the analysis pool where the stream is hash partitioned by cache key and sent to workers. Each worker maintains a hotlist of the busiest keys in its hash partition.
  4. In response to periodic requests from the UI, the analysis pool merges reports from all its workers into a single sorted hotlist, which is displayed to the user.


Need to contact us directly? Email [email protected] and be sure to include the name of this project in the subject.

Copyright and License

Copyright 2017 Box, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.