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

Hiroshi Ikeda commented on HBASE-14479:
---------------------------------------

bq. The doRunLoop will doRead for each key gotten on a select.

Reader.doRunLoop calls doRead(key) once for each key selected, and doRead calls 
Connection.readAndProcess() once for each call. readAndProcess reads and 
processes at most one request from a socket for each call. Actually, 
readAndProcess prepares a buffer whose size is just equal to the request's one, 
and reads data and calls process().

That means, doRunLoop processes at most one request for each key selected, and 
the following request is required to be selected again in order to be processed.

That would be good if clients claimed one request at a time. Moreover, that 
naturally implements round-robin behavior for registered channels in the 
selector. But that is subtle for asynchronous multiple requests via one socket 
because of overhead including unnecessarily calling Selector.select().

If SASL is used and the request contains multiple substantial requests, all of 
them are processed in processUnwrappedData with while loop.


> Apply the Leader/Followers pattern to RpcServer's Reader
> --------------------------------------------------------
>
>                 Key: HBASE-14479
>                 URL: https://issues.apache.org/jira/browse/HBASE-14479
>             Project: HBase
>          Issue Type: Improvement
>          Components: IPC/RPC, Performance
>            Reporter: Hiroshi Ikeda
>            Assignee: Hiroshi Ikeda
>            Priority: Minor
>         Attachments: HBASE-14479-V2 (1).patch, HBASE-14479-V2.patch, 
> HBASE-14479-V2.patch, HBASE-14479.patch, flamegraph-19152.svg, 
> flamegraph-32667.svg, gc.png, gets.png, io.png, median.png
>
>
> {{RpcServer}} uses multiple selectors to read data for load distribution, but 
> the distribution is just done by round-robin. It is uncertain, especially for 
> long run, whether load is equally divided and resources are used without 
> being wasted.
> Moreover, multiple selectors may cause excessive context switches which give 
> priority to low latency (while we just add the requests to queues), and it is 
> possible to reduce throughput of the whole server.



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

Reply via email to