-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
total_items seems have a weird behavior #1061
Comments
Hi.
set: always allocates a new item, overwrites an existing item. touch/gat: these commands only update item metadata while held under a lock, so they do not cause the item to be re-created. under most workloads |
@dormando Does the user need to know whether memcached internally allocated memory or not in a write command? Wouldn't it be more straight-forward for the user if you simply define |
it's been like that long before I was involved in the project. Issuing a set against memcached is replacing an item in cache, so semantically it should count as a new item. In practice total_items is the same as the number of set/append/prepend calls. it's a misunderstanding to think that it's about expanding item size. incr is the only odd one because it has an optimization so it usually doesn't count as a new item. |
As you mentioned, something about this metric doesn't make sense entirely, namely about expanding item size in |
@QuChen88 what information were you hoping to get from the counter? It's still useful from a developer perspective since it helps me understand what's happening under the hood of a user instance. As far as users are concerned I'm not sure what the potential usage could ever be. I'd hide the value from a standard dashboard. I can see "how many sets weren't in the cache before" but not exactly sure what you would do with that information, and "total_items - cmd_set" gets pretty close to that regardless. |
The name implies to me that is it about |
Okay so you're just looking through all of the counters and writing internal documentation maybe? I do the best I can by documenting every counter in If the |
Yes we were going over the list of documented |
I agree the documentation for that stat looks out of date. Please leave this issue open until it's updated. |
For fun I did a git dive.
interesting. |
just took another look at this. Not super sure what to do about it. Leaning towards just removing the counter entirely. As I noted above it lost its meaning after incr/decr/append/prepend/etc were added. There are counters for all of the various commands and counters for the current number of items linked into the hash table. I could add the bump instead to Seems like a semantic minefield so probably removal is the best idea. |
Hello, when I am testing the memcached, I found the
total_items
have a weird behavior. From the protocol.txt, this stat refers toTotal number of items stored since the server started
. It looks like this should record all items ever created and stored in the server.When I run following test in memcached 1.6.21, I found that
prepend
,append
and sometimesincr
will increase this stats( whenincr
an item that changed its original size). So I think thetotal_items
change when items with updated size.But when
set
an existing key with same value, flag and expire time, thetotal_item
still increase with no extra space necessarily need to allocate, and sincetouch
andgat
won't increase this stat, so looks like the change of ttl is not the rule to increase this metric.Could you help to explain how this
total_items
expected to increase?Thanks
The text was updated successfully, but these errors were encountered: