[ 
https://issues.apache.org/jira/browse/BEAM-13015?focusedWorklogId=721763&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-721763
 ]

ASF GitHub Bot logged work on BEAM-13015:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Feb/22 08:16
            Start Date: 07/Feb/22 08:16
    Worklog Time Spent: 10m 
      Work Description: scwhittle commented on a change in pull request #16745:
URL: https://github.com/apache/beam/pull/16745#discussion_r800402411



##########
File path: 
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/BeamFnStateGrpcClientCache.java
##########
@@ -87,9 +88,12 @@ private GrpcStateClient(ApiServiceDescriptor 
apiServiceDescriptor) {
       this.apiServiceDescriptor = apiServiceDescriptor;
       this.outstandingRequests = new ConcurrentHashMap<>();
       this.channel = channelFactory.apply(apiServiceDescriptor);
+      // We use the directExecutor because we just complete futures when 
handling responses.
+      // This showed a 1-2% improvement in the 
ProcessBundleBenchmark#testState* benchmarks.
       this.outboundObserver =
           outboundObserverFactory.outboundObserverFor(
-              BeamFnStateGrpc.newStub(channel)::state, new InboundObserver());
+              
BeamFnStateGrpc.newStub(channel).withExecutor(MoreExecutors.directExecutor())::state,
+              new InboundObserver());

Review comment:
       Can you add a comment in InboundObserver.next that it should not block 
as it is run on a direct executor?

##########
File path: 
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/BeamFnStateGrpcClientCache.java
##########
@@ -87,9 +88,12 @@ private GrpcStateClient(ApiServiceDescriptor 
apiServiceDescriptor) {
       this.apiServiceDescriptor = apiServiceDescriptor;
       this.outstandingRequests = new ConcurrentHashMap<>();
       this.channel = channelFactory.apply(apiServiceDescriptor);
+      // We use the directExecutor because we just complete futures when 
handling responses.
+      // This showed a 1-2% improvement in the 
ProcessBundleBenchmark#testState* benchmarks.
       this.outboundObserver =
           outboundObserverFactory.outboundObserverFor(
-              BeamFnStateGrpc.newStub(channel)::state, new InboundObserver());
+              
BeamFnStateGrpc.newStub(channel).withExecutor(MoreExecutors.directExecutor())::state,

Review comment:
       There is also the option to create a grpc channel that executes directly 
instead of an executor which is says can give transport ability to optimize 
further:
   
https://grpc.github.io/grpc-java/javadoc/io/grpc/ManagedChannelBuilder.html#directExecutor--
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 721763)
    Time Spent: 61h  (was: 60h 50m)

> Optimize Java SDK harness
> -------------------------
>
>                 Key: BEAM-13015
>                 URL: https://issues.apache.org/jira/browse/BEAM-13015
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-harness
>            Reporter: Luke Cwik
>            Assignee: Luke Cwik
>            Priority: P2
>          Time Spent: 61h
>  Remaining Estimate: 0h
>
> Use profiling tools to remove bundle processing overhead in the SDK harness.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to