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

ASF GitHub Bot commented on SCB-1056:
-------------------------------------

yhs0092 commented on a change in pull request #1017: [SCB-1056] put provider 
flow control logic in front
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1017#discussion_r238050682
 
 

 ##########
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/AbstractRestInvocation.java
 ##########
 @@ -150,6 +167,39 @@ protected void scheduleInvocation() {
     });
   }
 
+  private Holder<Boolean> checkQpsFlowControl(OperationMeta operationMeta) {
+    Holder<Boolean> qpsFlowControlReject = new Holder<>(false);
+    Handler providerQpsFlowControlHandler = 
findQpsFlowControlHandler(operationMeta);
+    if (null != providerQpsFlowControlHandler) {
+      try {
+        providerQpsFlowControlHandler.handle(invocation, response -> {
+          qpsFlowControlReject.value = true;
+          produceProcessor = ProduceProcessorManager.JSON_PROCESSOR;
+          sendResponse(response);
+        });
+      } catch (Exception e) {
+        LOGGER.error("failed to execute ProviderQpsFlowControlHandler", e);
+        qpsFlowControlReject.value = true;
+        sendFailResponse(e);
+      }
+    }
+    return qpsFlowControlReject;
 
 Review comment:
   I don't quite understand this statement.
   Do you mean in line 175
   ```
   providerQpsFlowControlHandler.handle(invocation, response -> {
   ```
   the `response` may be null?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Put provider QPS flow control in front
> --------------------------------------
>
>                 Key: SCB-1056
>                 URL: https://issues.apache.org/jira/browse/SCB-1056
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: YaoHaishi
>            Assignee: YaoHaishi
>            Priority: Major
>
> Currently provider QPS flow control is in ProviderQpsFlowControlHandler which 
> works in provider handler chain. As a result, the flow control logic takes 
> effect too late and much CPU resource is wasted on processing those requests 
> that should be rejected earlier.
> Put the provider QPS flow control logic in front can save the resource.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to