You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Hudson (Jira)" <ji...@apache.org> on 2022/02/23 19:30:00 UTC

[jira] [Commented] (HBASE-26659) The ByteBuffer of metadata in RAMQueueEntry in BucketCache could be reused.

    [ https://issues.apache.org/jira/browse/HBASE-26659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497014#comment-17497014 ] 

Hudson commented on HBASE-26659:
--------------------------------

Results for branch branch-2.5
	[build #50 on builds.a.o|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50/]: (x) *{color:red}-1 overall{color}*
----
details (if available):

(/) {color:green}+1 general checks{color}
-- For more information [see general report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50/General_20Nightly_20Build_20Report/]




(/) {color:green}+1 jdk8 hadoop2 checks{color}
-- For more information [see jdk8 (hadoop2) report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50/JDK8_20Nightly_20Build_20Report_20_28Hadoop2_29/]


(/) {color:green}+1 jdk8 hadoop3 checks{color}
-- For more information [see jdk8 (hadoop3) report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50/JDK8_20Nightly_20Build_20Report_20_28Hadoop3_29/]


(/) {color:green}+1 jdk11 hadoop3 checks{color}
-- For more information [see jdk11 report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50/JDK11_20Nightly_20Build_20Report_20_28Hadoop3_29/]


(x) {color:red}-1 source release artifact{color}
-- See build output for details.


(x) {color:red}-1 client integration test{color}
-- Something went wrong with this stage, [check relevant console output|https://ci-hbase.apache.org/job/HBase%20Nightly/job/branch-2.5/50//console].


> The ByteBuffer of metadata in RAMQueueEntry in BucketCache could be reused.
> ---------------------------------------------------------------------------
>
>                 Key: HBASE-26659
>                 URL: https://issues.apache.org/jira/browse/HBASE-26659
>             Project: HBase
>          Issue Type: Improvement
>          Components: BucketCache, Performance
>            Reporter: Yutong Xiao
>            Assignee: Yutong Xiao
>            Priority: Major
>             Fix For: 2.5.0, 3.0.0-alpha-3
>
>
> Currently, the process to write HFileBlocks into IOEngine in BucketCache is:
> {code:java}
>  if (data instanceof HFileBlock) {
>           // If an instance of HFileBlock, save on some allocations.
>           HFileBlock block = (HFileBlock) data;
>           ByteBuff sliceBuf = block.getBufferReadOnly();
>           ByteBuffer metadata = block.getMetaData();
>           ioEngine.write(sliceBuf, offset);
>           ioEngine.write(metadata, offset + len - metadata.limit());
>         }
> {code}
> The getMetaData() function in HFileBlock is:
> {code:java}
> public ByteBuffer getMetaData() {
>     ByteBuffer bb = ByteBuffer.allocate(BLOCK_METADATA_SPACE);
>     bb = addMetaData(bb, true);
>     bb.flip();
>     return bb;
>   }
> {code}
> It will allocate new ByteBuffer every time.
> We could reuse a local variable of WriterThread to reduce the new allocation of this small piece ByteBuffer.
> Reasons:
> 1. In a WriterThread, blocks in doDrain() function are written into IOEngine sequentially, there is no multi-threads problem.
> 2. After IOEngine.write() function, the data in metadata ByteBuffer has been transferred into ByteArray (ByteBufferIOEngine) or FileChannel (FileIOEngine) safely. The lifecycle of it is within the if statement above. So that it could be cleared and reused by the next block's writing process.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)