I have set Item Size to 128M and Maximum Memory to 1024M in my memcached configuration. But when I run this command:
ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5
71.7 0.0 3072592 4537 /usr/bin/memcached -vv -m 1024 -p 11211 -u memcache -l 0.0.0.0 -I 128M
Which states that memcached is taking 3GB of memory. Now I understand when we set Item Size larger than 1MB, memory consumption of memcached increases. But 3GB when you have set Maximum memory to 1GB seems to be quite much.
Is is always so or I am doing something wrong? Is there anyway to decrease this memory consumption?
Note: Although keys that I am currently storing in the memcached or a little over 1MB but size of these keys keeps increasing continuously, so to be safe in the future I have set the Item size to maximum possible!