This is epic!
Info why this is epic here.
Info on the implementation is in the release notes
From the release notes, please remember that the slab reassignment feature is in beta and is subject to some changes.
I just took the regular spec file I found for the project elsewhere and modified it a little. I disabled the SASL stuff in my spec file since we don’t use it and I didn’t want to mess with building it.
So here you go:
Setup your RPM Build environment and some dependencies:
sudo yum -y install rpmdevtools libevent-devel rpmdev-setuptree
Grab and place the source and spec file:
wget http://memcached.googlecode.com/files/memcached-1.4.12.tar.gz \ -O ~/rpmbuild/SOURCES/memcached-1.4.12.tar.gz wget https://raw.github.com/nmilford/specfiles/master/memcached-1.4/memcached-1.4.spec \ -O ~/rpmbuild/SPECS/memcached-1.4.spec
Build the RPM:
rpmbuild -bb ~/rpmbuild/SPECS/memcached-1.4.spec
And here on you can install it:
sudo rpm -Uvh ~/rpmbuild/RPMS/x86_64/memcached-1.4.12-1.x86_64.rpm
On nodes you didn’t just install libevent-devel on to build it, you’ll want to install libevent.
sudo yum -y install libevent
From here on, set your cache size and other stuff in
/etc/sysconfig/memcached, but mainly you’ll want to enable the slab manipulation option.
Under the OPTIONS environment variable add
-o slab_reassign for manual adjustment and
-o slab_reassign,slab_automove if you want to try out the automatic memory reassignment algorithm.
Now you can fire it up!
sudo /etc/init.d/memcached start
You can verify it is up and responsive thus:
echo stats | nc localhost 11211
You can see info on the slab stuff here:
echo stats | nc localhost 11211 | grep slab
And you can turn the automatic algorithm on or off on a live instance:
echo "slabs automove 0" | nc localhost 11211
Ha ha! Glorious Victory!