[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-14 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


liubao68 closed pull request #577: [SCB-352] refactor QpsControllerManager, 
support operation level qps controll on provider side
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/577
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/handlers/handler-flowcontrol-qps/pom.xml 
b/handlers/handler-flowcontrol-qps/pom.xml
index e9c10bdd1..86a3943ec 100644
--- a/handlers/handler-flowcontrol-qps/pom.xml
+++ b/handlers/handler-flowcontrol-qps/pom.xml
@@ -16,29 +16,34 @@
   -->
 
 http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
-   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
-   4.0.0
-   
-   org.apache.servicecomb
-   handlers
-   1.0.0-m1
-   
-   handler-flowcontrol-qps
-   Java Chassis::Handlers::Flow Control QPS
-   
-   
-   org.apache.servicecomb
-   java-chassis-core
-   
-   
-   org.slf4j
-   slf4j-log4j12
-   test
-   
-   
-   log4j
-   log4j
-   test
-   
-   
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd;>
+  4.0.0
+  
+org.apache.servicecomb
+handlers
+1.0.0-m1
+  
+  handler-flowcontrol-qps
+  Java Chassis::Handlers::Flow Control QPS
+  
+
+  org.apache.servicecomb
+  java-chassis-core
+
+
+  org.slf4j
+  slf4j-log4j12
+  test
+
+
+  log4j
+  log4j
+  test
+
+
+  org.apache.servicecomb
+  foundation-test-scaffolding
+  test
+
+  
 
diff --git 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/ConsumerQpsControllerManager.java
 
b/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/ConsumerQpsControllerManager.java
deleted file mode 100644
index 076df492d..0
--- 
a/handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/ConsumerQpsControllerManager.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.servicecomb.qps;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.servicecomb.core.definition.OperationMeta;
-import org.apache.servicecomb.foundation.common.AbstractObjectManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.netflix.config.DynamicProperty;
-
-/**
- * 以microservice.schema.operation为key
- * 如果配置只到microservice级别,那么该microservice中所有的key都关联到同一个qpsController实例
- * 然后schema、operation级别有独立配置的,单独关联自己的qpsController实例
- *
- * schema级独立的qpsController统计时,并不会导致microservice级别的统计也改变,operation级别规则也相同
- * 即:统计只在qpsController实例内部生效,不会产生实例间的关联
- *
- */
-public class ConsumerQpsControllerManager extends 
AbstractObjectManager {
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerQpsControllerManager.class);
-  // 最终使用的QpsController实例,实际都是从下面的map中引用出来的,不会独立创建
-
-  // 3种类型的key都保存在这里,不存在冲突
-  // microservice
-  // microservice.schema
-  // microservice.schema.operation
-  private Map qpsControllerMap = new 
ConcurrentHashMap<>();
-
-  // 避免重复watch
-  // 只会在create流程中调用,是有锁保护的,不必考虑多线程并发
-  private Set watchedKeySet = new HashSet<>();
-
-  @Override
-  protected String getKey(OperationMeta operationMeta) {
-return operationMeta.getMicroserviceQualifiedName();
-  }
-
-  private QpsController initQpsLimit(String 

[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


coveralls commented on issue #577: [SCB-352] refactor QpsControllerManager, 
support operation level qps controll on provider side
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/577#issuecomment-371106161
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15889527/badge)](https://coveralls.io/builds/15889527)
   
   Coverage increased (+0.05%) to 87.235% when pulling 
**f0a54d32f6e639ef19d08964d069eacb8a60e794 on 
yhs0092:support_provider_operation_level_flow_control** into 
**e1137b4002659d3a7e482d3ed4b7a6f226054798 on apache:master**.
   


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
> Attachments: compile_warning.PNG, compile_warning2.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


yhs0092 commented on a change in pull request #577: [SCB-352] refactor 
QpsControllerManager, support operation level qps controll on provider side
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/577#discussion_r173378612
 
 

 ##
 File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
 ##
 @@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.qps;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicProperty;
+
+public class QpsControllerManager {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(QpsControllerManager.class);
+
+  private static final Pattern QUALIFIED_KEY_CHECKER = 
Pattern.compile("^[^.]+\\.[^.]+\\.[^.]+$");
+
+  /**
+   * Describe the relationship between configuration and qpsController.
+   */
+  protected final Map configQpsControllerMap = new 
ConcurrentHashMapEx<>();
+
+  /**
+   * Describe the relationship between qualifiedKey(format is 
"microservice.schema.operation") and qpsController.
+   */
+  protected final Map qualifiedNameControllerMap = new 
ConcurrentHashMapEx<>();
+
+  protected QpsController globalQpsController;
+
+  public static final String SEPARATOR = ".";
+
+  private String configKeyPrefix;
+
+  public QpsController getOrCreate(String key) {
+return qualifiedNameControllerMap.computeIfAbsent(key, this::create);
+  }
+
+  /**
+   * Create relevant qpsLimit dynamicProperty and watch the configuration 
change.
+   * Search and return a valid qpsController.
+   */
+  protected QpsController create(String qualifiedNameKey) {
+if (!QUALIFIED_KEY_CHECKER.matcher(qualifiedNameKey).matches()) {
+  throw new IllegalArgumentException("Unexpected qualified name: [" + 
qualifiedNameKey + "]");
+}
+// create "microservice"
+createQpsControllerIfNotExist(qualifiedNameKey.substring(0, 
qualifiedNameKey.indexOf(SEPARATOR)));
+// create "microservice.schema"
+createQpsControllerIfNotExist(qualifiedNameKey.substring(0, 
qualifiedNameKey.lastIndexOf(SEPARATOR)));
 
 Review comment:
   OK. I will add naming convention instructions in gitbook later.


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
> Attachments: compile_warning.PNG, compile_warning2.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-08 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


liubao68 commented on a change in pull request #577: [SCB-352] refactor 
QpsControllerManager, support operation level qps controll on provider side
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/577#discussion_r173107595
 
 

 ##
 File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/QpsControllerManager.java
 ##
 @@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.qps;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.netflix.config.DynamicProperty;
+
+public class QpsControllerManager {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(QpsControllerManager.class);
+
+  private static final Pattern QUALIFIED_KEY_CHECKER = 
Pattern.compile("^[^.]+\\.[^.]+\\.[^.]+$");
+
+  /**
+   * Describe the relationship between configuration and qpsController.
+   */
+  protected final Map configQpsControllerMap = new 
ConcurrentHashMapEx<>();
+
+  /**
+   * Describe the relationship between qualifiedKey(format is 
"microservice.schema.operation") and qpsController.
+   */
+  protected final Map qualifiedNameControllerMap = new 
ConcurrentHashMapEx<>();
+
+  protected QpsController globalQpsController;
+
+  public static final String SEPARATOR = ".";
+
+  private String configKeyPrefix;
+
+  public QpsController getOrCreate(String key) {
+return qualifiedNameControllerMap.computeIfAbsent(key, this::create);
+  }
+
+  /**
+   * Create relevant qpsLimit dynamicProperty and watch the configuration 
change.
+   * Search and return a valid qpsController.
+   */
+  protected QpsController create(String qualifiedNameKey) {
+if (!QUALIFIED_KEY_CHECKER.matcher(qualifiedNameKey).matches()) {
+  throw new IllegalArgumentException("Unexpected qualified name: [" + 
qualifiedNameKey + "]");
+}
+// create "microservice"
+createQpsControllerIfNotExist(qualifiedNameKey.substring(0, 
qualifiedNameKey.indexOf(SEPARATOR)));
+// create "microservice.schema"
+createQpsControllerIfNotExist(qualifiedNameKey.substring(0, 
qualifiedNameKey.lastIndexOf(SEPARATOR)));
 
 Review comment:
   We need to add naming conventions to docs of service name, schema and 
operation 


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG, compile_warning2.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


coveralls commented on issue #577: [SCB-352] refactor QpsControllerManager, 
support operation level qps controll on provider side
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/577#issuecomment-371106161
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15849967/badge)](https://coveralls.io/builds/15849967)
   
   Coverage increased (+0.03%) to 87.249% when pulling 
**bc0496708fb6d9ff75401064d9bbd6b9cd3d4aa3 on 
yhs0092:support_provider_operation_level_flow_control** into 
**83ae473e27889734d8cc0ecf428cd2538d26b1a4 on apache:master**.
   


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG, compile_warning2.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


yhs0092 opened a new pull request #577: SCB-352 refactor QpsControllerManager, 
support operation level qps controll on provider side
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/577
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [x] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [x] Each commit in the pull request should have a meaningful subject line 
and body.
- [x] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [x] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [x] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [x] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   Refactor QpsControllerManager and support operation level qps flow control 
on provider side.
   
[https://issues.apache.org/jira/browse/SCB-352](https://issues.apache.org/jira/browse/SCB-352)
   
   
![compile_warning](https://issues.apache.org/jira/secure/attachment/12913363/compile_warning2.PNG
 "compile warning")


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG, compile_warning2.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


yhs0092 commented on issue #568: [SCB-352] Support provider operation level 
flow control
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/568#issuecomment-370813848
 
 
   i am refactoring this issue, please do not review this pull request now.


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


liubao68 commented on a change in pull request #568: [SCB-352] Support provider 
operation level flow control
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/568#discussion_r172427781
 
 

 ##
 File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/config/QpsDynamicConfigWatcher.java
 ##
 @@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.qps.config;
+
+import java.util.Map;
+
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.apache.servicecomb.qps.QpsController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.eventbus.EventBus;
+import com.netflix.config.DynamicProperty;
+
+/**
+ * Watch qps config and refresh corresponding {@link 
org.apache.servicecomb.qps.QpsController}.
+ */
+public class QpsDynamicConfigWatcher {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(QpsDynamicConfigWatcher.class);
+
+  public static final String SEPARATOR = ".";
+
+  private final EventBus eventBus = new EventBus();
 
 Review comment:
   Try EventManage mentioned in 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/570


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


liubao68 commented on a change in pull request #568: [SCB-352] Support provider 
operation level flow control
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/568#discussion_r172423155
 
 

 ##
 File path: 
handlers/handler-flowcontrol-qps/src/main/java/org/apache/servicecomb/qps/config/QpsDynamicConfigWatcher.java
 ##
 @@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.qps.config;
+
+import java.util.Map;
+
+import org.apache.servicecomb.core.definition.OperationMeta;
+import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx;
+import org.apache.servicecomb.qps.QpsController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.eventbus.EventBus;
+import com.netflix.config.DynamicProperty;
+
+/**
+ * Watch qps config and refresh corresponding {@link 
org.apache.servicecomb.qps.QpsController}.
+ */
+public class QpsDynamicConfigWatcher {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(QpsDynamicConfigWatcher.class);
+
+  public static final String SEPARATOR = ".";
+
+  private final EventBus eventBus = new EventBus();
+
+  /**
+   * Contains three kinds of keys which are corresponding to the actual qps 
configuration:
+   * 
+   *   microservice
+   *   microservice.schema
+   *   microservice.schema.operation
+   * 
+   */
+  private final Map qpsControllerMap = new 
ConcurrentHashMapEx<>();
+
+  private QpsController globalQpsController;
+
+  private String qpsLimitConfigKeyPrefix = "";
+
+  /**
+   * Register a new observer. Once the qps config is changed, observer will be 
noticed.
+   *
+   * @param subscriber the registered observer
+   */
+  public void register(Object subscriber) {
+LOGGER.info("An observer is registered: [{}]", subscriber);
 
 Review comment:
   This will print an object address


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
> Attachments: compile_warning.PNG
>
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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


[jira] [Commented] (SCB-352) Support operation level flow control on provider side

2018-03-05 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on SCB-352:


yhs0092 opened a new pull request #568: [SCB-352] Support provider operation 
level flow control
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/568
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   Refactor QpsControllerManager and support operation level qps flow control 
on provider side.
   
[https://issues.apache.org/jira/browse/SCB-352](https://issues.apache.org/jira/browse/SCB-352)


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:
us...@infra.apache.org


> Support operation level flow control on provider side
> -
>
> Key: SCB-352
> URL: https://issues.apache.org/jira/browse/SCB-352
> Project: Apache ServiceComb
>  Issue Type: Task
>Reporter: YaoHaishi
>Assignee: YaoHaishi
>Priority: Major
>
> At present our provider qps flow control only support microservice level.
> We need to support schema/operation level qps flow control like consumer side.



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