Bug 48738 - [PATCH]Allow GzipOutputFilter to send partial result when flushBuffer() is called
Summary: [PATCH]Allow GzipOutputFilter to send partial result when flushBuffer() is ca...
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 6.0.20
Hardware: All Mac OS X 10.4
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2010-02-13 23:28 UTC by Jiong Wang
Modified: 2010-09-07 12:02 UTC (History)
1 user (show)

patch for the making GzipOutputFilter work with early flush (10.65 KB, patch)
2010-02-13 23:28 UTC, Jiong Wang
Details | Diff
Port of TC7 patch for Tomact 6 (11.07 KB, patch)
2010-08-24 14:59 UTC, Mark Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiong Wang 2010-02-13 23:28:26 UTC
Created attachment 24979 [details]
patch for the making GzipOutputFilter work with early flush

As part of our site speed optimizations (at Linkedin) we bumped into a problem when trying to do partial flush of compressed content stream from Tomcat to the browser. We discovered the root cause to be a couple of long outstanding JDK bugs:


Basically, with the GzipOutputFilter turned on, the GZIPOutputStream it uses internally buffers the data that's been sent over, and does not flush to client (browser) when flushBuffer() is invoked.

We have produced a patch which we verified internally, that it did work to do a partial flush on the compressed stream. We also have a unit testcase included in the patch to quickly show the problem. 

Early flush is a quite useful technique that many sites out there can benefit from to speed up the page download/rendering time, and by having it working in tomcat would benefit the existing and new customers. 

Comment 1 Konstantin Kolinko 2010-02-13 23:47:31 UTC
Thank you for the patch.
I updated Summary and Severity of this issue.
Comment 2 Mark Thomas 2010-08-24 06:09:31 UTC
The patch (with some slight modifications) has been applied to trunk and will be included in 7.0.3 onwards.
Comment 3 Mark Thomas 2010-08-24 14:59:52 UTC
Created attachment 25932 [details]
Port of TC7 patch for Tomact 6

I'll propose this patch for 6.0.x
Comment 4 Mark Thomas 2010-09-07 12:02:03 UTC
Patch has been applied to 6.0.x and will be included in 6.0.30 onwards.

Thanks again for your efforts.