-
Notifications
You must be signed in to change notification settings - Fork 281
Tracking per-pool usage stats #141
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
@guptask: Can you clarify the goal of this change? The change here only exports how many bytes is allocated towards each memory pool. (It doesn't track per allocation class usage). For pool size, you should already be able to get it via For per-allocation-class size, you can refer to |
Are you referring to the |
@guptask: You can already get this stat by checking |
I get your point now. The This is part of the initial step towards the background eviction changes we'll send upstream for reviews later. Exposing this statistic via cachebench allows us to observe the growth and shrinking of pool usage on graphana. This helps with tuning of the eviction policies. |
@guptask: Hmm I don't fully follow. Do you want to know a memory pool's amount of bytes that are currently allocated for items in cache? If so, you should exclude free memory that are nonetheless "allocated" for this pool. MPStats->freeSlabs and aggregate of ACStats->freeSlabs both are considered free memory. You also want to exclude ACStats->freeAllocs. You can get all of this by looking at the The computation of freeMemoryBytes() is in MPStats class, and can be found here: https://github.com/facebook/CacheLib/blob/main/cachelib/allocator/memory/MemoryAllocatorStats.h#L104 |
Thanks. I'll update the PR accordingly. |
b4579b7
to
1d186de
Compare
@@ -116,6 +118,12 @@ struct Stats { | |||
<< std::endl; | |||
out << folly::sformat("RAM Evictions : {:,}", numEvictions) << std::endl; | |||
|
|||
for (auto pid = 0U; pid < poolUsageFraction.size(); pid++) { |
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.
This is only tracking per-pool usage stats right? Can you update the PR title to reflect this?
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.
done
@therealgymmy has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This per pool size statistics reports the current used space in each memory pool. Pool Usage = PoolStats->poolUsableSize - PoolStats->freeMemoryBytes(). This statistics will be reported in the final report generated by cachebench.