0

I am new to memcached but have installed and am using it for an application.

My application reports that it should have a few hundred thousand items cached, however memcached says it only has anywhere between 11k and 13k items. I also see many cache misses.

Here's my /etc/sysconfig/memcached file

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="7GB"
OPTIONS=""

As you can see it should have 7 GB of RAM to work with, however I don't know if it ever goes above using 30 MB.

CentOS 7, Memcached version 1.4.15

Some relevant stats

STAT cmd_get 320529
STAT cmd_set 111654
STAT cmd_flush 0
STAT cmd_touch 0
STAT get_hits 258056
STAT get_misses 62473
STAT delete_misses 4
STAT delete_hits 11
...
STAT bytes 28758173
STAT curr_items 12385
STAT total_items 111654
STAT expired_unfetched 0
STAT evicted_unfetched 73714
STAT evictions 97315
4
  • How is your application determining how many items should be cached? How big is the average item? – ceejayoz Sep 15 '17 at 14:14
  • My application server is storing the cache keys in a lookup object for hit/miss stats. As for item size, I would say they range from a few hundred bytes to 50kb, average size is probably 1-3kb. – Tyler Clendenin Sep 15 '17 at 14:24
  • Well, 13k * ~2kb objects is going to take up right around 30 MB of RAM, so I'd say the problem likely lies in your application, not memcached. – ceejayoz Sep 15 '17 at 14:46
  • I don't think so, it seems to me that memcached is getting rid of cache items without me asking it to. I'll edit my post to include some stats. – Tyler Clendenin Sep 15 '17 at 18:40
0

It seems my configuration was incorrect, I had CACHESIZE="7GB", I don't know why it didn't throw an error, but I don't think it accepts that format, so I changed it to CACHESIZE="7168" and things seem much better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.