-
Notifications
You must be signed in to change notification settings - Fork 592
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
Entry stats #159
Comments
That already exists, see here. Or is this something different? |
@mxplusb those are global stats but not specific to the Entry. I was thinking |
Currently we don't have this feature, but the idea sounds reasonable. Store per item stats might be useful. I'm afraid of few obvious things:
To solve 1st we might ask for a max memory for stats (treat this as a leaking stats). Any suggestions or design ideas @mingard ? |
@cristaloleg I think definitely making this optional and default to disabled. In respect to the memory issue, I suppose it's worth testing, but as long as the stats are minimal perhaps just a request count per entry, and they are properly disposed of when the entry is removed, it shouldn't be too heavy. In relation to CPU where a number will need to be incremented each time an Entry is accessed perhaps using an atomic counter would lower the resource required. |
I don't think the memory consumption will be terribly high, we could limit it to
I think this one should be tested, so long as it's not part of the core code path then it should be fine. So long as we ship the stats to a channel after the cache has been read or written to, it shouldn't be enough of an impact for latency to be that noticeable. We could always provide a set of recommendations, like using a multi-core system for best performance. Either way, I'm happy to review a PR and see the initial implementation. :) |
@mxplusb I'll do my best! |
@cristaloleg is it possible to release this? |
@mingard done! see v2.1.4 |
@cristaloleg thank you so much! |
Being able to see the number of times a cached resource was requested is a useful metric, especially at the point of removal.
As a production example,
OnRemove
could be used to trigger cache pre-warming based on the frequency of cache hits on a resource within a given window.I'm aware of the overhead of storing such data by default and suggest this only as an optional parameter.
Thoughts?
The text was updated successfully, but these errors were encountered: