Last updated 8 years ago by tarkus .
Original npm · Tarball · package.json
$ cnpm install memcached-usage 
SYNC missed versions from official npm registry.

Memcached Usage

memcached-usage is a tool can help analyzing memcached memory usage in various scenarios.

How it works

memcached-usage will spawn a memcached server, fill it up with varying or particular size values, and output a usage report. With the usage report, you can fine tune the related settings e.g. chunk_size, growth_factor. This bundle also included some test scenarios, check it out before write your own.


  • memcached
  • node
  • npm


clone this repo

git clone

install the dependencies with npm

cd memcached-usage
npm install`

now you are ready to run the test scenario

node run.js

A Peek at Memcached's Memory Management


Slab is the way memcached used to allocate chunks, basically, they are representing different sizes memory chunks. When you request memory, memcached will calculate the chunk size based on the settings of chunk_size and growth_factor, then give you whether a free chunk or create a new slab class, in closest size.

Useful Command

  • stats - general information
  • stats slabs - useful information dedicated on slabs class and slab usage.
  • stats settings - some settings can be set using command options, man memcached for details


You can use memcache-top to monitor memcached status.


Memcached protocol


Set the fixture size and run through the test, I figure out,

  • if only store fixed size objects, the usage are too dynamical, in range from 50% up to 98%, it's depend on the object size, chunk_size, and growth_factor, the best fit object produces highest usage.

  • if store small objects in varying size, you can get average usage near 93%


  • Storing fixed size objects in memcached is very tricky, you need to carefully adjust the chunk_size and growth_factor to match the object size.

  • Using memcached as a pool to store varying size objects is the mature way.

  • Avoiding store big objects into memcached. Besides memcached's 1MB hard limit on object size, you need very special settings to reduce the wasted memory. The usage of store big objects is much lower than store small ones.

Current Tags

  • 0.9.0                                ...           latest (8 years ago)

1 Versions

  • 0.9.0                                ...           8 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © |