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

Sanjay Radia commented on HADOOP-9151:
--------------------------------------

Binglin, you are suggesting to merge the rpc-request body inside the 
RpcRequestHeader and the rpc-repsponse body inside RpcResponseHeader. You are 
right in that we could add a bytes field to each of the headers and that it 
would not break the Multiple rpc engine abstraction.
Generally it is better to keep the distinct "messages" distinct, each 
length-deliminated. The Protobuf rpc messages of the various RPC services get 
generated independently anyway. As far as efficiency there are two separate 
issues. 
# wire packets - we are writing data into a tcp stream via a bufferOutputStream 
and so there should be no difference.
# internal buffers - indeed putting the body inside the header can cause extra 
copying depending on how you write your code.  A further note on internal data 
copying: our rpc code should be changed to use CodeOutputStream to minimize 
data copying; I will file a jira for that.

While I was changing the code, I noticed that the ProtobufRpcEngine.proto 
includes the rpc message inside the header and indeed that will force extra 
copying and in my opinion should have been kept distinct.
                
> Include RPC error info in RpcResponseHeader instead of sending it separately
> ----------------------------------------------------------------------------
>
>                 Key: HADOOP-9151
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9151
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Sanjay Radia
>            Assignee: Sanjay Radia
>         Attachments: HADOOP-9151.patch
>
>


--
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