Skip to content

Commit

Permalink
Reduce overhead count by 2 rather than 1 for non-overhead frames
Browse files Browse the repository at this point in the history
This means that the overhead count for a well-behaved conenction should
trend downwards over time.
  • Loading branch information
markt-asf committed Jun 15, 2021
1 parent f0a3e1f commit 9448048
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion java/org/apache/coyote/http2/Http2Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class Http2Protocol implements UpgradeProtocol {
static final int DEFAULT_OVERHEAD_COUNT_FACTOR = 1;
// Not currently configurable. This makes the practical limit for
// overheadCountFactor to be 2.
static final int DEFAULT_OVERHEAD_REDUCTION_FACTOR = -1;
static final int DEFAULT_OVERHEAD_REDUCTION_FACTOR = -2;
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;
Expand Down
7 changes: 7 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@
overhead count that Tomcat uses to detect and close potentially
malicious connections. (markt)
</add>
<update>
Many HTTP/2 requests from browsers will trigger one overhead frame and
one non-overhead frame. Change the overhead calculation so that a
non-overhead frame reduces the current overhead count by 2 rather than
1. This means that, over time, the overhead count for a well-behaved
connection will trend downwards. (markt)
</update>
</changelog>
</subsection>
<subsection name="Other">
Expand Down
2 changes: 1 addition & 1 deletion webapps/docs/config/http2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<attribute name="overheadCountFactor" required="false">
<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</code>. The count is decreased for each
count starts at <code>-10</code>. The count is decreased by 2 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
Expand Down

0 comments on commit 9448048

Please sign in to comment.