Becker Ewing created HBASE-29099: ------------------------------------ Summary: Avoid expensive BlockCacheKey.toString() calls when tracing is disabled Key: HBASE-29099 URL: https://issues.apache.org/jira/browse/HBASE-29099 Project: HBase Issue Type: Improvement Components: Performance Affects Versions: 2.5.11, 2.6.1, 3.0.0-beta-1, 4.0.0-alpha-1 Reporter: Becker Ewing Assignee: Becker Ewing Attachments: high-block-cache-key-to-string-alloc-profile.html
Currently, when reading a block from the BlockCache, [we always calculate BlockCacheKey.toString()|https://github.com/apache/hbase/blob/b89c8259c5726395c9ae3a14919bd192252ca517/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java#L1290-L1296] so that we can add it to the Tracing Span. In a region server running extremely hot (pinned at 100% CPU utilization for many hours due to a reverse scanning hotspot), I noticed that in an allocation profile—see attached—of the region server that almost 9% of all allocations were to calculate BlockCacheKey.toString() which I found to be rather unusual. Given that BlockCacheKey.toString() is only used to enhance traceability of region servers, it feels like we should be able to skip calling this expensive function is we can determine that tracing is disabled. Note: this function was already identified as inefficient and had it's performance optimized as part of HBASE-19684. I'm not certain whether we can do much better than it's current implementation. -- This message was sent by Atlassian Jira (v8.20.10#820010)