zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] hanm commented on a change in pull request #986: ZOOKEEPER-3243: Add server-side request throttling
Date Sat, 22 Jun 2019 04:28:09 GMT
hanm commented on a change in pull request #986: ZOOKEEPER-3243: Add server-side request throttling
URL: https://github.com/apache/zookeeper/pull/986#discussion_r296433383
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
 ##########
 @@ -910,6 +957,36 @@ protected void setLocalSessionFlag(Request si) {
     }
 
     public void submitRequest(Request si) {
+        if (RequestThrottler.enabled()) {
+            enqueueRequest(si);
+        } else {
+            submitRequestNow(si);
+        }
+    }
+
+    public void enqueueRequest(Request si) {
+        if (requestThrottler == null) {
+            synchronized (this) {
+                try {
+                    // Since all requests are passed to the request
+                    // processor it should wait for setting up the request
+                    // processor chain. The state will be updated to RUNNING
+                    // after the setup.
+                    while (state == State.INITIAL) {
+                        wait(1000);
 
 Review comment:
   1 sec feels a little bit ... longer. How did we decide this value? Should it be configurable?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message