[
https://issues.apache.org/jira/browse/HBASE-14490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14907951#comment-14907951
]
Hiroshi Ikeda commented on HBASE-14490:
---------------------------------------
{{ByteBuffer.array}} might contain garbage. Also keeping objects tend to
require Full GC to collect the objects.
> [RpcServer] reuse buffer and more stricter code
> -----------------------------------------------
>
> Key: HBASE-14490
> URL: https://issues.apache.org/jira/browse/HBASE-14490
> Project: HBase
> Issue Type: Improvement
> Components: IPC/RPC
> Reporter: Zephyr Guo
> Assignee: Zephyr Guo
> Attachments: HBASE-14490-v1.patch, Test.java
>
>
> 1.Reuse buffer to read request.
> It's not necessary free data's buffer for each request.It can cause memory
> fragmentation.
> 2.There are hidden trouble in socket IO with non-blocking mode.
> We just use *channel.read(byteBuffer)* to read data of
> request(byteBuffer.limit=dataLength).We need *dataLength* bytes but read
> maybe not fill the *byteBuffer*.
> The link is the *read(byteBuffer)* method
> describe:http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html#read(java.nio.ByteBuffer)
> I write a sample to test it(Test.java).
> 3.*channelIO()* method return value
> More stricter return value.
> So I rewrite *channelIO*.It can work well with non-blocking and back small
> IO(size<NIO_BUFFER_LIMIT) or large.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)