hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zephyr Guo (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14490) [RpcServer] reuse request read buffer
Date Thu, 01 Oct 2015 11:12:27 GMT

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

Zephyr Guo commented on HBASE-14490:

[~anoop.hbase] Thanks for your review.

 If read alone is the consideration, it is high?
Seem big.How about 16K?I have no test.Just experience...
Dynamic adjustment is better?Set it to average at sometime.
We need to have check <= ?
If dataLength==READ_REQ_REUSED_BUF_SIZE, we can use it exactly.

processRequest(ByteBuffer buf)
I will improve the method.

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?

invoking chain:
process —> saslReadAndProcess —> processUnwrappedData

Supposing we come into processUnwrappedData now.Define A as reused buffer and B as temporary
buffer(a large buffer).

{{data}} is not null obviously(reference to A or B) and it has no useful data to read.So we
just use {{data}} again.
In the end of {{process}}, we do {{data = null}}. If {{data}} is A, the BB will be reference
by SoftRef only.If data is B, no one reference to it.

Because we have no variable {{unwrappedData}}, so we can clear buffer uniformly.Just set data
to be null in end of {{process}}.

U mean call to evaluateResponse occurs just once? After that the boolean saslContextEstablished
will be true.
At least occur one time.I just want to say ‘evaluateResponse(byte[] rsp, int off, int len)
is best’.But SASL API not look like this currently.So we have to copy.
replyToken = saslServer.evaluateResponse(
            new Bytes(saslToken.array(), saslToken.position(), saslToken.remaining()).copyBytes());
I mark here by ’TODO’.If the API be improved in the future, we can modify here.If there
misunderstanding , can remove.It’s not important.

> [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,
> 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}}
> * 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

View raw message