PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 12, 2022

[FIXED] Why is total_items larger than curr_items in Memcached when I have plenty of memory and items are set to never expire?

 November 12, 2022     memcached     No comments   

Issue

I have a memcached instance set up with 10GB of space on an ec2 instance with plenty of memory (15 gb I believe). I'm confused to see that the stat "total_items" is larger than the curr_items stat considering that when items are written to memcache, the timeout is set to 0 (never expire). Could someone explain these stats for me and why it does not seem to have every item in the cache still?

STAT cmd_set 174978 ... STAT delete_misses 0 STAT delete_hits 0 ... STAT bytes_read 45749254 STAT bytes_written 26472821 STAT limit_maxbytes 10737418240 ... STAT bytes 25386981 STAT curr_items 99198 STAT total_items 174978 STAT evictions 0 STAT reclaimed 0


Solution

I don't think total_items means what you think it means. It is a simple counter which increases whenever something is stored. A simple test verifies this. Store the same object twice. curr_items will be one, total_items will be two. Since your evictions and reclaims are both zero, everything that was ever stored is still there, as nothing has been evicted and no expired keys have been reclaimed. The data may have changed over time, but everything is still there.



Answered By - Mikkel Løkke
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing