mckoy – [m]em[c]ache [k]ey [o]bservation [y]ield

Posted on by

We wanted to speed up our web-applications by alleviating our database-loads. So we decided to use the distributed memory object caching system, memcached. Due to the many requests of our memcached-systems (about 1.5 million requests per second), we built a tool (called mckoy), which is capable to perform statistics and debugging information about all memcache-requests in our network.

mckoy is a memcache protocol sniffer (based on pcap library) and statistics builder. It automatically detects and parses each key (and its value) and memcache-api methods.  At  the  end of the sniffing session, the results are used to build the statisticis. mckoy was written to analyse our web application and its usage of  memcache-api in PHP. For example: We wanted to know how many set() and get() methods were invoked in a given time. Based on these results,  we had to make changes to improve the usage of memcache-api for PHP. You can run mckoy on any UNIX based systems. It was tested on many *BSD and Linux systems. mckoy is licensed under GPLv3 and completely published as opensource project!

You can run mckoy in various modes (see manpage!). For example, if you want to sniff pattern “foobar” for all memcache-api methods and with live capturing, use:

mckoy -i <interface> -e “port 11211” -m 5 -k foobar -v

And this is, how it looks like:

Unfortunately, there are some known bugs. :) For example: An SIGSEGV will encounter when ^C is sent from user. Also, we noticed that mckoy isn’t able to handle memcached-1.2.8 <= 1.4.* correctly. These bugs will be fixed in the next version as soon as possible! For the next version I also planned to build in udp and binary support.

You can offcially download mckoy from:


5 thoughts on “mckoy – [m]em[c]ache [k]ey [o]bservation [y]ield

  1. Pingback: Twitted by pst555

  2. Great tool, thx!

    There’s a little typo within the manpage:

    -m mode Specify which mode to sniff, e.g: set(), get() or all methods (use 0 to list available modes)

    I think “6” lists all available modes, “0” shows up “gets”:

    [+] available modes:
    0 – get
    1 – set
    2 – delete
    3 – increment
    4 – decrement
    5 – all methods


  3. Very, very marvelous… I am deeply grateful for this tool.
    Really very GREAT!!!!
    Kind regards!

  4. Vielen Dank für das coole Tool. Ist seit vorhin bei uns im Einsatz und hat sich schon bewährt :-)

    Weiter so!

    PS: Cache Hitrate 96.09% :-)

  5. Pingback: mckoy – Memcached Sniffer at neues aus der kommandozentrale

Leave a Reply

Your email address will not be published. Required fields are marked *