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 #1051: Add server side large request throttling
Date Mon, 12 Aug 2019 22:01:28 GMT
hanm commented on a change in pull request #1051: Add server side large request throttling
URL: https://github.com/apache/zookeeper/pull/1051#discussion_r313144393
 
 

 ##########
 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:
   This `testRequestSize` is on critical path of every request (when every request is a large
request - or when it's configured that way with -1), having three `LOG.info` in this function
will probably lead to miserable performance.
   
   Should we change it to DEBUG or just remove the log completely?

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