How to increase the amount of memory Memcache uses?


Step 1: find memcached settings file:

[root@tutorialspots /]# find -name memcached
./etc/sysconfig/memcached
./etc/selinux/targeted/active/modules/100/memcached
./home/nodejs2/node_modules/memcached
./usr/bin/memcached
./usr/share/doc/pecl/memcached

You see location: /etc/sysconfig/memcached

Then view content of this file

[root@tutorialspots /]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="20"
OPTIONS=""

It means current amount of memory Memcached uses is 20Mb, how to increase it?

Step 2: Edit this file

You can change this amout to 4Gb

CACHESIZE="4096"

Step 3: restart memcached service

service memcached restart

You can use theses script to see memcached status
+ Memcache.php by Harun Yayli
+ PHP Memcached Admin

Leave a Reply