hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiroshi Ikeda (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14490) [RpcServer] reuse request read buffer
Date Fri, 25 Sep 2015 19:56:04 GMT

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

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

{code}
    private void process() throws IOException, InterruptedException {
      data.flip();
     (...skip...)
        if (useSasl) {
          saslReadAndProcess(data.array());
        } else {
          processOneRpc(data.array());
        }
{code}

{{data.array()}} just exposes its backed byte array. ({{data.flip()}} at that position is
meaningless at all.) That means, the instance variable {{data}} should be a non-direct buffer
which always has the same length of received data, or you should rewrite {{saslReadAndProcess}}/{{processOneRpc}}
methods to accept a byte buffer instead of a byte array.

BTW, about generational GC, it is better to distinguish between objects to drop immediately
and objects to keep and reuse for ever (or for as long as possible). It is said that creating
objects in heap is not so expensive, and keeping objects halfway has the opposite effect.


> [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
>            Reporter: Zephyr Guo
>            Assignee: Zephyr Guo
>            Priority: Minor
>         Attachments: HBASE-14490-v1.patch, HBASE-14490-v2.patch
>
>
> Reuse buffer to read request.It's not necessary free data's buffer for each RPC.It maybe
can cause memory fragmentation.Allocate buffer also has some cost.



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

Mime
View raw message