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

Anoop Sam John commented on HBASE-14490:
----------------------------------------

bq.READ_REQ_REUSED_BUF_SIZE = 48 * 1024;
You are doing it along with read reqs I believe.  Write will have large message 
size as that will contain the cells. So based on what tests u have taken 48 KB 
size? If read alone is the consideration, it is high?

bq.if (READ_REQ_REUSED_BUF_SIZE < dataLength)
We need to have check <= ?

processRequest(ByteBuffer buf) 
There is some offset manipulation going on this method after reading header 
length, header etc.  Based on the move fwd of offset, the length is not getting 
reduced. In current code also this happens BTW.  Will be better correct?  Seems 
no issues coming in though
Not ur patch, but we will do CodedInputStream.newInstance 2 times here. We can 
avoid the second one? We can do skipRawBytes on the CodedInputStream created 
and come to the point where we can read the paramSize.  Pls check once.

processUnwrappedData
We use 'data' ByteBuffer here also. Allocate bigger sized BB and will refer it 
from then on. The 'unwrappedData' ref set to be null now. But we dont do that 
for data.  That be an issue? Why dont going with SoftRef way here? Am I missing 
some thing?

{quote}
// SASL API evaluateResponse(byte[] response) is so hard.
1413              // Because saslToken is a reused buffer, so we can not direct 
use saslToken.arrray().
1414              // We have to copy it. Copy will break optimization about 
reusing buffer.
1415              // Luckily, evaluateResponse just occurs several times.
1416              // We can write well if SASL API will be improved.
1417              replyToken = saslServer.evaluateResponse(
1418                new Bytes(saslToken.array(), saslToken.position(), 
saslToken.remaining()).copyBytes());
{quote}
U mean call to evaluateResponse occurs just once? After that the boolean 
saslContextEstablished will be true.


> [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, HBASE-14490-v8.patch, 
> HBASE-14490-v9.patch
>
>
> Reuse buffer to read request.It's not necessary free data's buffer for each 
> request.Optimization is to reduce the times that allocate ByteBuffer.
> *patch modification*
> * {{saslReadAndProcess}} and {{processOneRpc}} accept a ByteBuffer instead of 
> byte[].
> * {{processUnwrappedData}} can reuse the same ByteBuffer that 
> {{saslReadAndProcess}} used.
> * Maintaining a reused ByteBuffer each {{Reader}} for most request.
> ** Buffer size is fixed.
> ** Using a SoftReference to reference the buffer.
> ** If request is too large, we allocate a temporary ByteBuffer.Freeing it 
> when  {{process()}} will have been finished.



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

Reply via email to