Bug 51513 - GzipInterceptor: Do not compress small packages
Summary: GzipInterceptor: Do not compress small packages
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Cluster (show other bugs)
Version: 6.0.29
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-15 10:53 UTC by Christian Stöber
Modified: 2017-07-03 19:24 UTC (History)
0 users



Attachments
Patch for this enhancement (9.60 KB, text/plain)
2011-07-18 05:19 UTC, Christian Stöber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Stöber 2011-07-15 10:53:41 UTC
As Mark said (see 51475) here is the new bug record.

Because it's not desirable and efficient to compress small packages, I've
modified the GzipInterceptor that it compresses only packages with a size greater than 2048 bytes. Based on org.apache.coyote.http11.Http11Protocoll this value is user configurable.

To distinguish if data is compressed or not, I've added a small one byte header, which defines if the data is compressed or not.

I'm also recording some stats, which can be disabled.
Comment 1 Konstantin Kolinko 2011-07-16 01:31:26 UTC
It sounds like you have a patch. If you want to propose it, add it as an attachment to this issue.
Comment 2 Mark Thomas 2011-07-16 12:53:19 UTC
I wonder if differentiation between compressed content and non-compressed content is why this hasn't been implemented before. I also wonder about the protocol change. New messages have been added the past (that will be ignored if not understood) but I don't recall actually changing the protocol.
Comment 3 Christian Stöber 2011-07-18 05:19:24 UTC
Created attachment 27295 [details]
Patch for this enhancement

Here is the patch. I must have forgotten. I thougt I uploaded it when submitting the bug.
Comment 4 Mark Thomas 2017-07-03 19:24:46 UTC
Apologies it took so long to return to this.

I've applied a variation of the patch. The main changes were:
- separate statsEnabled and interval (users might want stats via JMX without
  logging)
- defaults same as current behaviour
- added some Javadoc
- used optionFlags to indicate if compression has been applied

The fix has been applied to 9.0.x.

I do not currently have plans to back-port it.