zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] jhuan31 commented on a change in pull request #1051: ZOOKEEPER-3503: Add server side large request throttling
Date Tue, 13 Aug 2019 21:32:48 GMT
jhuan31 commented on a change in pull request #1051: ZOOKEEPER-3503: Add server side large
request throttling
URL: https://github.com/apache/zookeeper/pull/1051#discussion_r313622557
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
 ##########
 @@ -1358,6 +1395,68 @@ static void setMaxBatchSize(int size) {
         maxBatchSize = size;
     }
 
+    public int getLargeRequestMaxBytes() {
+        return largeRequestMaxBytes;
+    }
+
+    public void setLargeRequestMaxBytes(int bytes) {
+        largeRequestMaxBytes = bytes;
+    }
+
+    public int getLargeRequestThreshold() {
+        return largeRequestThreshold;
+    }
+
+    public void setLargeRequestThreshold(int threshold) {
+        largeRequestThreshold = threshold;
+    }
+
+    public int getLargeRequestBytes() {
+        return currentLargeRequestBytes.get();
+    }
+
+    private boolean isLargeRequest(int length) {
+        // The large request limit is disabled when threshold is -1
+        if (largeRequestThreshold == -1) {
+            return false;
+        }
+        return length > largeRequestThreshold;
+    }
+
+    private boolean testRequestSize(int length, boolean increment) {
+        if (!isLargeRequest(length)) {
+            // Always allow small requests
+            return true;
+        }
+
+        LOG.info("length {} increment {}", length, increment);
 
 Review comment:
   Thanks so much! I added those for debugging and forgot to delete them. 

----------------------------------------------------------------
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