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

Hiroshi Ikeda commented on HBASE-14490:
---------------------------------------

"It maybe cause memory fragmentation" in the description is incorrect. 
Fragmentation is resolved for each GC by copying between an Eden space and 
Survivor spaces in young generation. That means, keeping a byte array (backing 
in a byte buffer) might cause overhead of copying for each GC, even if the 
array's contents are garbage after use. I think the overhead of creating a byte 
array almost comes from filling zero, and the advantage of keeping a byte array 
ends when GC is occurred.

If you stick to keeping a byte array, I suggest to use a weak reference. Also 
making new byte buffer with the twice size of previous one is appropriate to 
reduce creation.



> [RpcServer] reuse request read buffer
> -------------------------------------
>
>                 Key: HBASE-14490
>                 URL: https://issues.apache.org/jira/browse/HBASE-14490
>             Project: HBase
>          Issue Type: Improvement
>          Components: IPC/RPC
>    Affects Versions: 2.0.0, 1.0.2
>            Reporter: Zephyr Guo
>            Assignee: Zephyr Guo
>              Labels: performance
>             Fix For: 2.0.0, 1.0.2
>
>         Attachments: HBASE-14490-v1.patch, HBASE-14490-v2.patch, 
> HBASE-14490-v3.patch, HBASE-14490-v4.patch, HBASE-14490-v5.patch, 
> HBASE-14490-v6.patch, HBASE-14490-v7.patch
>
>
> Reuse buffer to read request.It's not necessary free data's buffer for each 
> request.It maybe can cause memory fragmentation.Allocate buffer also has some 
> cost.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to