Category Archives: Memcached

memcache-top patch to see curr_items

I stumbled upon memcache-top in the Homebrew Formula repository. It’s a neat little Perl application that aggregate stats from a memcached cluster and displays it in a nice little table.

I like to use: memcache-top --servers='server1,server2,server3' --commands --sleep=1

My only qualm is it doesn’t display the curr_items stat. So I wrote a little patch for v0.6 that will add an ITEMS column to the table.

Get the patch from the issue I filed.

How to dump memcache key/value pairs fast

Recently we migrated our memcached cluster to a new larger one. This needed to be done mostly for reliability and speed, but it’s also nice being able to have access to new stats like ‘reclaimed’ in 1.4.5.

We decided against migrating data from cluster to cluster because there are long-expire keys we no longer care about. Instead, we just ran some scripts to fill the new cluster with new data. After the scripts finished and the new cluster ran in production for a couple days, it only contained ~70% the data the old cluster possessed. We were curious what that old data was, so we decided to dump it and analyze.
Continue reading

Nginx modules for a memcached page cache cluster

Nginx already has a neat module included with it to proxy requests to a memcached server (memcached_pass). Combine that with the upstream round robin load balancer, you have the beginnings of a memcached page cache cluster for your nginx. However, calling each server sequentially can become quite expensive if the key resides in one of the last servers.

Continue reading