You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/07/22 11:31:33 UTC
[GitHub] [hbase] wchevreuil commented on a diff in pull request #4637: HBASE-27225 Add BucketAllocator bucket size statistic logging
wchevreuil commented on code in PR #4637:
URL: https://github.com/apache/hbase/pull/4637#discussion_r927557082
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java:
##########
@@ -247,12 +247,24 @@ public void freeBlock(Bucket b, long offset) {
public synchronized IndexStatistics statistics() {
long free = 0, used = 0;
+ int full = 0;
for (Object obj : bucketList.keySet()) {
Bucket b = (Bucket) obj;
free += b.freeCount();
used += b.usedCount();
+ if (!b.hasFreeSpace()) {
+ full++;
+ }
}
- return new IndexStatistics(free, used, bucketSizes[sizeIndex]);
+ int bucketObjectSize = bucketSizes[sizeIndex];
+ // this is most likely to always be 1 or 0
+ int fillingBuckets = Math.max(0, freeBuckets.size() - completelyFreeBuckets.size());
+ // if bucket capacity is not perfectly divisible by a bucket's object size, there will
+ // be some left over per bucket. for some object sizes this may be large enough to be
+ // non-trivial and worth tuning by choosing a more divisible object size.
+ long waistedBytes = (bucketCapacity % bucketObjectSize) * (full + fillingBuckets);
Review Comment:
Mind teach me briefly on this math here? Aren't `bucketCapacity` and `bucketObjectSize` computed for each individual bucket? If so, why are we multiplying by the number of buckets that already have some data? Wouldn't this (bucketCapacity % bucketObjectSize) differ for each bucket?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org