Bug 48738

Summary: [PATCH]Allow GzipOutputFilter to send partial result when flushBuffer() is called
Product: Tomcat 6 Reporter: Jiong Wang <jiwang>
Component: ConnectorsAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement CC: james
Priority: P2 Keywords: PatchAvailable
Version: 6.0.20   
Target Milestone: default   
Hardware: All   
OS: Mac OS X 10.4   
Attachments: patch for the making GzipOutputFilter work with early flush
Port of TC7 patch for Tomact 6

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.