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

ASF GitHub Bot commented on HADOOP-18533:
-----------------------------------------

slfan1989 commented on code in PR #5151:
URL: https://github.com/apache/hadoop/pull/5151#discussion_r1027163886


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -1941,6 +1963,20 @@ public ByteBuffer readResponse() throws IOException {
     public void sendRequest(byte[] buf) throws IOException {
       out.write(buf);
     }
+  
+    public void sendRequest(ProtobufRpcEngine2.RpcProtobufRequestWithHeader 
rpcRequest)
+            throws IOException {
+      out.writeInt(rpcRequest.getLength());
+      rpcRequest.getHeader().writeDelimitedTo(out);
+      rpcRequest.getRpcRequest().writeTo(out);
+    }
+  
+    public void sendRequest(int totalSize, RpcRequestHeaderProto header,
+                            Message rpcRequest) throws IOException {

Review Comment:
   5 character indentation is usually required
   
   ```
    public void sendRequest(int totalSize, RpcRequestHeaderProto header,
           Message rpcRequest) throws IOException {
   ```





> RPC Client performance improvement
> ----------------------------------
>
>                 Key: HADOOP-18533
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18533
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: rpc-server
>            Reporter: xinqiu.hu
>            Priority: Minor
>              Labels: pull-request-available
>
>   The current implementation copies the rpcRequest and header to a 
> ByteArrayOutputStream in order to calculate the total length of the sent 
> request, and then writes it to the socket buffer.
>   But if the rpc engine is ProtobufRpcEngine2, we can pre-calculate the 
> request size, and then send the request directly to the socket buffer, 
> reducing a memory copy. And avoid allocating 1024 bytes of ResponseBuffer 
> each time a request is sent.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to