Learning the basics of Memcached

Quick post to write down some resources to learn a bit about Memcached. I've used it from time to time but never got into learning how it works under the hood (at least an overall view).

Useful links

The protocol description is the first and foremost resource you should read. To complement it, I highly encourage reading also LZone's Memcached Cheat Sheet.

Regarding how to scale it, Skyscanner post regarding scaling was a simple but good introduction, also useful to learn about consistent hashing.

Journey to the centre of Memcached summarizes how the slabs, pages, chunks, and items work. It also helps you to begin using the stats command and interpreting the data it returns.

Oracle's page about memcached general statistics also has some useful tidbits.

Memcached Command-Line Options Explains precisely that, the CLI options just in case you can/need to tweak them.

Memcached Exporter for Prometheus is quite self-descriptive, a way to obtain all metrics from the stats command for consumption by Prometheus.

And finally, regarding tooling I'm still checking what's out there, so don't have much to mention. The default memcached-tool script is useful, but I like the efficiency metrics that memcached-tool-ng provides.


  • Docker's official memcached container doesn't contains any configuration file (runs with all the defaults), don't search for one.
  • maximum connections (-c) controls the bandwidth, meanwhile backlog queue limit (-b) is a single queue for that bandwidth that allows to not have client connection errors when the connections limit is reached.
  • evictions are bad; expirations, reclaims, etc. are fine.

Tags: Development

Learning the basics of Memcached article, written by Kartones. Published @