-
Notifications
You must be signed in to change notification settings - Fork 190
introduce new stats item EvictedBytes #93
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
Conversation
It's incremented on bucket clean up and reports bytes evicted from memory. It should help to understand an amount of extra memory needed for fastcache to serve requests rate on constantly evicted keys. Related PR VictoriaMetrics/VictoriaMetrics#9293
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Introduces a new EvictedBytes metric to track the total amount of bytes evicted from the fastcache when bucket cleanup occurs. This metric helps understand memory pressure and determine how much additional memory would be needed to avoid evictions for a given request rate.
- Added
EvictedBytesfield to theStatsstruct to expose the metric - Added corresponding
evictedBytescounter to the internalbucketstruct - Integrated the counter into bucket operations (reset, stats collection, and eviction tracking)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #93 +/- ##
==========================================
+ Coverage 76.68% 76.81% +0.12%
==========================================
Files 4 4
Lines 549 552 +3
==========================================
+ Hits 421 424 +3
Misses 73 73
Partials 55 55 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This reverts commit 1412165. Reason for revert: the exposed EvictedBytes metric is misleading - it doesn't reflect the real eviction rate of the data in the cache, since old data is overwritten by the new data in the cyclic buffer formed from the cache chunks, on the addition of new items to the cache. It is impossible to detect the eviction rate since the code doesn't know when it overwrites the already existing data. The EvictedBytes metric is just increased by the total size of chunks on every wraparound in the shard. This can be used as a rough estimation of the evicted bytes, but it is updated too rarely on large caches. It is possible to add WrittenBytes metric, which will show the number of bytes written to the cache. This metric roughly equals to the EvictedBytes metric after the cache becomes full and old data starts to be overwritten by the new data. Both metrics have zero practical applicability, so it is better to drop the EvictedBytes metric even if it has been already exposed in public, in order to reduce the complexity of the code and reduce the confusion for the users who try using this metric. All the users of this metric must stop using it. Updates #93 Updates VictoriaMetrics/VictoriaMetrics#9293
|
FYI, this pull request has been reverted in the commit f608073 . Reason for revert - the introduced EvictedBytes metric is misleading and it has zero practical sense. |
…1.13.2 This is needed for removing the EvictedBytes metric from the fastcache. See the description of VictoriaMetrics/fastcache@f608073 for details. Updates #9293 Updates VictoriaMetrics/fastcache#93
…1.13.2 This is needed for removing the EvictedBytes metric from the fastcache. See the description of VictoriaMetrics/fastcache@f608073 for details. Updates #9293 Updates VictoriaMetrics/fastcache#93
It's incremented on bucket clean up and reports bytes
evicted from memory. It should help to understand an amount of extra memory needed for fastcache to serve requests rate on constantly evicted keys.
Related PR VictoriaMetrics/VictoriaMetrics#9293