You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/06/15 16:48:02 UTC

[tomcat] branch 8.5.x updated: Multiple increment and decrement by 10 to provide more control

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new f7d7702  Multiple increment and decrement by 10 to provide more control
f7d7702 is described below

commit f7d7702f9b4e1c2e8eff3f1b8dfc41261a97cca8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jun 14 22:21:34 2021 +0100

    Multiple increment and decrement by 10 to provide more control
    
    overheadCountFactor can now be in range 0-20 rather than 0-2.
---
 java/org/apache/coyote/http2/Http2Protocol.java       | 7 ++++---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 6 +++---
 webapps/docs/changelog.xml                            | 8 ++++++++
 webapps/docs/config/http2.xml                         | 8 ++++----
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2Protocol.java b/java/org/apache/coyote/http2/Http2Protocol.java
index ec94c2c..13a41bb 100644
--- a/java/org/apache/coyote/http2/Http2Protocol.java
+++ b/java/org/apache/coyote/http2/Http2Protocol.java
@@ -64,10 +64,11 @@ public class Http2Protocol implements UpgradeProtocol {
     // a single connection
     static final int DEFAULT_MAX_CONCURRENT_STREAM_EXECUTION = 20;
 
-    static final int DEFAULT_OVERHEAD_COUNT_FACTOR = 1;
+    static final int DEFAULT_OVERHEAD_COUNT_FACTOR = 10;
     // Not currently configurable. This makes the practical limit for
-    // overheadCountFactor to be 2.
-    static final int DEFAULT_OVERHEAD_REDUCTION_FACTOR = -2;
+    // overheadCountFactor to be ~20. The exact limit will vary with traffic
+    // patterns.
+    static final int DEFAULT_OVERHEAD_REDUCTION_FACTOR = -20;
     static final int DEFAULT_OVERHEAD_CONTINUATION_THRESHOLD = 1024;
     static final int DEFAULT_OVERHEAD_DATA_THRESHOLD = 1024;
     static final int DEFAULT_OVERHEAD_WINDOW_UPDATE_THRESHOLD = 1024;
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 6192879..e990f41 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1400,7 +1400,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
         // Http2Protocol.DEFAULT_OVERHEAD_REDUCTION_FACTOR. A simple browser
         // request is likely to have one non-overhead frame (HEADERS) and one
         // overhead frame (REPRIORITISE). With the default settings the overhead
-        // count will reduce by 1 for each simple request.
+        // count will reduce by 10 for each simple request.
         // Requests and responses with bodies will create additional
         // non-overhead frames, further reducing the overhead count.
         updateOverheadCount(frameType, Http2Protocol.DEFAULT_OVERHEAD_REDUCTION_FACTOR);
@@ -1410,10 +1410,10 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH
     private void increaseOverheadCount(FrameType frameType) {
         // An overhead frame increases the overhead count by
         // overheadCountFactor. By default, this means an overhead frame
-        // increases the overhead count by 1. A simple browser request is
+        // increases the overhead count by 10. A simple browser request is
         // likely to have one non-overhead frame (HEADERS) and one overhead
         // frame (REPRIORITISE). With the default settings the overhead count
-        // will reduce by 1 for each simple request.
+        // will reduce by 10 for each simple request.
         updateOverheadCount(frameType, getProtocol().getOverheadCountFactor());
     }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8e32feb..eb34b00 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -141,6 +141,14 @@
         opens 10 overhead frames in a row will be required to trigger the
         overhead protection. (markt)
       </update>
+      <update>
+        Increase the default <code>overheadCountFactor</code> from
+        <code>1</code> to <code>10</code> and change the reduction in overhead
+        count for a non-overhead frame from <code>-2</code> to <code>-20</code>.
+        This allows for a larger range (0-20) to be used for
+        <code>overheadCountFactor</code> providing for finer-grained control.
+        (markt)
+      </update>
     </changelog>
   </subsection>
 </section>
diff --git a/webapps/docs/config/http2.xml b/webapps/docs/config/http2.xml
index 6e7d548..87c3d31 100644
--- a/webapps/docs/config/http2.xml
+++ b/webapps/docs/config/http2.xml
@@ -220,14 +220,14 @@
       <p>The factor to apply when counting overhead frames to determine if a
       connection has too high an overhead and should be closed. The overhead
       count starts at <code>-10 * overheadCountFactor</code>. The count is
-      decreased by 2 for each data frame sent or received and each headers frame
+      decreased by 20 for each data frame sent or received and each headers frame
       received. The count is increased by the <code>overheadCountFactor</code>
       for each setting received, priority frame received and ping received. If
       the overhead count exceeds zero, the connection is closed. A value of less
       than <code>1</code> disables this protection. In normal usage a value of
-      <code>3</code> or more will close the connection before any streams can
-      complete. If not specified, a default value of <code>1</code> will be
-      used.</p>
+      approximately <code>20</code> or higher will close the connection before
+      any streams can complete. If not specified, a default value of
+      <code>10</code> will be used.</p>
     </attribute>
 
     <attribute name="overheadDataThreshold" required="false">

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org