?

Log in

No account? Create an account

Libmemcached 0.43, Stats and Windows support!

« previous entry | next entry »
Aug. 2nd, 2010 | 10:02 am

Memcached has a "stats" command. Compared to the "get", "set",... it is a little awkward. What it does is provide diagnostic information about the internals of your Memcached server.The documentation on it is a bit sparse, and it is consistently one of the commands I find that very few memcached operators know about.

In 0.43 I have added memcached_stat_execute() to libmemcached. While we have had the ability to query stats since the beginning, the original interface in libmemcached was modeled off of a previous driver. The new interface was designed to be a bit more flexible.

memcached_stat_execute() takes a memcached_st which is a list of servers, and then calls each server passing the key/pair returned by the memcached server to a callback function. As an example:

rc= memcached_stat_execute(memc, "slabs", stat_printer, NULL);


Via this function call we will obtain all "slabs" information from a server, and send it through a callback function named "stat_printer". The NULL at the end is for a function pointer you can have passed to your callback. The interface is much simpler then the previous one, and we pass all key/pair in a manner requiring zero memory copying.

I had a customer request this feature a while ago, but a request from a Facebook engineer is what pushed us to pushing it into the main branch (and I am told that they now have it in production).

memstat has been updated to have --args. You can use this from the command line to look at all of the additional information that stats can provide (ie slabs, sizes, items...).

In other news, 0.43 ads preliminary compile support for Microsoft Windows. Windows is always a catch-22 in the open source world. Once you support it, users will show up. Rarely will Windows users do the initial port themselves. This is the first time we have had Windows support in trunk and as soon as I can get a Hudson builder up and running for it, we won't have to worry about regression on the Windows side (thanks to Trond, and others who have been doing this work). Trond has written up an introduction" to how it works.

Link | Leave a comment | Share

Comments {0}