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

Karthik Ranganathan commented on HBASE-7477:
--------------------------------------------


<< The pb Service 'fit' is not perfect though – it drags along some other stuff 
we do not want and it is missing a means of passing "extra" stuff unless we do 
some hackery – so reluctant to take it on though it does away with reflection. 
>>
Couldn't agree more. My thought was that HBase only exposes simple API's like 
get, put, delete and scan. Each of these in turn takes in 1 object 
(Get/Put/Delete/Scan), and a couple of filters. The serialization of the latter 
objects already seems to be versioned. So protobufs might be expensive for just 
eliminating reflection, but it might help with the automatic versioning for 
future enhancements. I think you said the same thing here: << Given the above, 
protobuf Service starts to look better. It has kinks but would enforce a strong 
pattern – and we are most of the way there already with our use of the 
Service#BlockingInterface. >>

I can do better than just explaining - can put up an initial patch that works 
for gets only. Will upload it next, but the changes are actually not very 
invasive. Here is an outline of steps:

- Replace the proxy with a HRegionInterfaceSerializerV1. It implements the RPC 
serialization when the method calls are made.
- On the server side, you would have the HRegionInterfaceDeserializerV1 object. 
You would use the method name to call the right function in this object, which 
deserializes the params. In the current incarnation, every method would do the 
same thing (read the params count, param classes, etc).
- Change the ser and deser objects to v2, bump up RPC version, substitute the 
method names for byte codes and make the serialization/deserialization of the 
params specific to the method that is called.

IMO, if you look at my next diff (where I reconstructed the HBase RPC 
protocol), its pretty verbose and inefficient. It roughly does the following:
* Get the class name, method name, num params, param classes by reflection
* write the class name (twice most of the time)
* write the num params
* write the types of each param
* then serialize each param
This makes coding nice, but hurts at the runtime perf.
                
> Remove Proxy instance from HBase RPC
> ------------------------------------
>
>                 Key: HBASE-7477
>                 URL: https://issues.apache.org/jira/browse/HBASE-7477
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Karthik Ranganathan
>         Attachments: 7477experiment.txt
>
>
> Currently, we use HBaseRPC.getProxy() to get an Invoker object to serialize 
> the RPC parameters. This is pretty inefficient as it uses reflection to 
> lookup the current method name.
> The aim is to break up the proxy into an actual proxy implementation so that:
> 1. we can make it more efficient by eliminating reflection
> 2. can re-write some parts of the protocol to make it even better

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to