The version of memcached available in the CentOS-6 repositories is currently 1.4.4. This performs well with small items however there is a limit of 1M and an issue with slab imbalance.
# rpm -q remi-release-6.8-2.el6.remi.noarch \
&> /dev/null \
|| yum -y install \
http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6.8-2.el6.remi.noarch.rpm \
&& yum -y --enablerepo=remi install \
memcached
Increase from 64M to 512M memory, bind to loopback IP address and increase item_size_max
to 2M.
We bind to the loopback address to prevent exposing the Memcached service since it can contain sensitive infomation. If binding to any other address measures should be taken to ensure access is limited to the necessary hosts.
# sed -i -r \
-e 's~^(CACHESIZE=).+$~\1"512"~' \
-e 's~^(MAXCONN=).+$~\1"1024"~' \
-e 's~^(OPTIONS=).+$~\1"-I 2m -l 127.0.0.1 -o modern"~' \
/etc/sysconfig/memcached
Set to start on server starup and start the service.
# chkconfig memcached on \
&& service memcached restart
$ memcached-tool 127.0.0.1:11211 settings