JDK-6751338 : ZIP inflater/deflater performance
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 1.4.2_10,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_ubuntu,windows_xp
  • CPU: x86
  • Submitted: 2008-09-23
  • Updated: 2011-09-08
  • Resolved: 2011-04-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
5.0u33Fixed 6u27-revFixed 7 b138Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Dear all,

This is a snippet from the correspondence with SAP, who run into severe performance issues with JDK 1.4.2_10. No improvement has been observed with the recent release of JDK 1.4.2_18.
------------------------------------------------------------------------------------------------------
In our BI application we have massive performance problems
because of java.util.zip.Deflater and Inflater. A lot of customer
cases and also several escalations resulted from this.

The problem is similar to that described in SUN bugid 6364346
and can be simply reproduced with the attached test program.

Just call:   java -Xms1024M -Xmx1024M Bench test.htm

With 1.4.2_09 the performance is excellent, with later patch releases
it's horrible.

Following you see the results on my desktop PC:

C:\tmp\java\Deflater>\java\jdk1.4.2_09\bin\java -server -showversion
-Xms1024M -
Xmx1024M Bench test.htm
java version "1.4.2_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-b05)
Java HotSpot(TM) Server VM (build 1.4.2_09-b05, mixed mode)

Original length: 46932100 bytes
Deflated length: 2026929 bytes
Inflated length: 46932100 bytes

Duration of Deflate (in ms): 1390
Duration of Inflate (in ms): 3063

C:\tmp\java\Deflater>java -server -showversion -Xms1024M -Xmx1024M Bench
 test.ht
m
java version "1.4.2_18"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_18-b06)
Java HotSpot(TM) Server VM (build 1.4.2_18-b06, mixed mode)

Original length: 46932100 bytes
Deflated length: 2026929 bytes
Inflated length: 46932100 bytes

Duration of Deflate (in ms): 2602891
Duration of Inflate (in ms): 2421922

C:\tmp\java\Deflater>\java\jdk1.4.2_10\bin\java -server -showversion
-Xms1024M -
Xmx1024M Bench test.htm
java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Server VM (build 1.4.2_10-b03, mixed mode)

Original length: 46932100 bytes
Deflated length: 2026929 bytes
Inflated length: 46932100 bytes

Duration of Deflate (in ms): 8056797
Duration of Inflate (in ms): 7869140
------------------------------------------------------------------------------------------------------

I've included a test case provided by SAP to this report. Please handle this case with high 
priority because as mentioned above it has big impact at customer side.

Comments
EVALUATION This fix is basically to back out the fix for #6206933 we made back to jdk5, which is to use malloc+GetByteArrayuRegion to replace the original GetPrimitiveArrayCritical/ ReleasePrimitiveArrayCritical() pair when access the java byte array at native code Inflater/Deflater.c, to mainly workaround the GC/Critical... issue discussed in #6186200. The change for #6206933 itself has triggered lots of performance issues since its integration, some fixed, some still outstanding. The GC rfe#6186200 has been fixed long time ago, after couple weeks of discussion/debating, we all agreed that it's the time to back out#6206933. The corresponding wewbrev is at http://cr.openjdk.java.net/~sherman/6751338/webrev/
20-05-2011

EVALUATION The customer has confirmed that the workaround for 1.4.2 is working to their satisfcation.
18-12-2008

EVALUATION A workaround has been given to the customer that uses striding along the lines as to what we have in DeflatorOutputStream. This can be tuned to get performance very close to what we had when the implementation used JNI critical sections. In the background we will continue the analysis with a iew to coming up with a better solution that doesn't delay GC too much. Our plan is to let that solution bake in jdk7 for a few months before considering it for an update of a shipping release.
25-10-2008

WORK AROUND This issue can be worked around by using striding as is done in DeflaterOutputStream.
08-10-2008

EVALUATION Putting in hprof cpu times results for this on jdk 6 rank self accum count trace method 1 54.08% 54.08% 63343 301064 java.util.zip.Deflater.deflate 2 45.11% 99.20% 1466630 301094 java.util.zip.Inflater.inflate 3 0.36% 99.55% 1466630 301095 java.util.zip.Inflater.inflate 4 0.28% 99.83% 1 301130 Bench.inflate 5 0.10% 99.93% 1466629 301096 Bench.grow 6 0.02% 99.95% 1 301068 Bench.deflate 7 0.02% 99.97% 63343 301065 java.util.zip.Deflater.deflate 8 0.01% 99.99% 1 301036 java.io.FileInputStream.read Even cpu samples results show similar behaviour. Deflater.deflate and Inflater.inflate take most of the time.
25-09-2008

EVALUATION Yes I tested this with 142_09 and 142_09 + fix for 6206933 The results show that this fix is causing the slowness. H:\Files\6751338>E:\ws\142\6751338\Output\bin\java -server -showversion -X ms1024M -Xmx1024M Bench test.htm java version "1.4.2_09-internal" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-internal-01) Java HotSpot(TM) Server VM (build 1.4.2_09-internal-01, mixed mode) Original length: 46932100 bytes Deflated length: 2026929 bytes Inflated length: 46932100 bytes Duration of Deflate (in ms): 2547 Duration of Inflate (in ms): 3860 *After putting the fix for 6206933* H:\Files\6751338>E:\ws\142\6751338\Output\bin\javac Bench.java H:\Files\6751338>E:\ws\142\6751338\Output\bin\java -server -showversion -X ms1024M -Xmx1024M Bench test.htm java version "1.4.2_09-internal" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_09-internal-01) Java HotSpot(TM) Server VM (build 1.4.2_09-internal-01, mixed mode) Original length: 46932100 bytes Deflated length: 2026929 bytes Inflated length: 46932100 bytes Still running..... for a long time.
25-09-2008

EVALUATION See 6206933.
24-09-2008