What’s new with Memcached

I post on this blog an interesting mail posted on Memcached Mailing List (http://groups.google.com/group/memcached) by Trond Norbye, check the original message here


We’ve done a lot of work since the latest 1.4.x release, but most of it has been invisible to most users. To catch up those who haven’t been actively watching development, we’re going to ease you into how it affects different segments of users, starting with general cache users.

We don’t expect much to have changed from the perspective of the typical memcached user. The purpose of most of the work is to turn memcached into an extensible platform on top of which users can experiment with new storage mechanisms, extending with new commands, changing logging, adding instrumentation, etc…
This is mostly a reaction to mailing lists posts where someone wants to do something that someone else doesn’t want done. We’ve gone out of our way to ensure that both can have what they want (and nobody has to fork).

Major Points

The biggest change is that the code is no longer one blob, but instead a set of modules the user may enable based upon their preference. This enables others to create their own backing store, and still use the same command parser and core protocol handling as everyone else.

Another change users may like is that the logging mechanism is another module, so that you can get all of the output to syslog (or windows event log if you like). We now have official support for Microsoft Windows !
We’re compiling the source on Microsoft Windows every day, so we find and fix bugs there at the same time as we do on the UNIX versions. The automatic testing isn’t as good as what we’ve got on UNIX, but believe me: we’re working on it!

Part of the point of going to modular components means that they are easier to test in a test program without having to “fork()” and test everything “over the wire”. We have tests that cover specific internals that can run very quickly.

New stats

There are a number of new stats introduced in the next release. The key supplied in the status command is passed to the storage engine to allow the storage engine to add extra information to the existing stats commands, and to create their own stat commands.

Stats returned by the default stats command


Over the time we’ve seen a lot of bugs around people using an old version of libevent. That’s part of the reason why we bundle a well known version of libevent in the release distribution. Memcached checks the libevent version during startup, and will refuse to start if the one used is too old. Since most operating systems use shared libraries these days, you might be using another version than the one you originally used when you first built memcached. In order for us to see which library people are using we decided to put it into the stats as well.


The number of times a connection attempt was refused (due when we’re hitting the maximum number of connections).


You may get information about the most popular keys in memcached by exporting the environment variable MEMCACHED_TOP_KEYS to the number of keys you would want memcached to keep track of.
There is no such thing as a free lunch, so enabling this will have an impact on memory and speed. We’ve decided to _disable_ this by default for now, So you need to export this variable to enable the feature.

Running “stats topkeys” would return something like (I’ve added the line breaks and indentations to make it more readable in this document):

We hope to characterize the impact of this new stat before the final release and would like to include your feedback.

Stats returned by aggregate

The combination of the storage engine interface and the SASL auth allows for the combination of a connection-based stats. The aggregate subcommand is used to aggregate the stats from all of the connections on the server. The stats returned from the aggregate subcommand is the same as the normal stats command.

Stats returned by stats settings


Displays one of the extensions loaded (may appear multiple times).


The number of keys we are monitoring.

For part 2 of “What’s new in Memcached”, check this post, more informations about Virtual buckets, new commands and modularity in it.

Leave a Reply