Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 379112

Summary: Performance issue on large WAR deployment
Product: [RT] Gemini.Web Reporter: Radoslav Ivanov <radoslav.ivanov>
Component: unknownAssignee: Project Inbox <gemini.web-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: milesg78
Version: unspecified   
Target Milestone: 2.1.0.RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch proposal
none
Patch proposal (new)
none
Code coverage
none
Patch and test milesg78: iplog+

Description Radoslav Ivanov CLA 2012-05-10 08:46:29 EDT
Build Identifier: 

Performance impact(scenario):
1. Deployment of large WAR(40Mb) from local file system
2. Lots of (122 jars) "WEB-INF/lib/*jar-s" (with  occurrences of Class-Path header 

Times:
On PC(64-bit Win7, 4CPUs, 8Gb RAM), the WAR scanning takes 2m 40sec.

Investigations:
After reviewing WebBundleScanner, obviously, on each nested jar the scanner:
1. opens WAR, reads and searches through all jar entries (again from the beginning) with "java.util.jar.JarInputStream.getNextJarEntry()", which is time consuming;
2. moreover, unnecessary class scanning is always going although notification for classes is disabled with "false" flag.


Reproducible: Always
Comment 1 Radoslav Ivanov CLA 2012-05-10 08:52:23 EDT
Created attachment 215391 [details]
Patch proposal

You see, the patch proposal deals with:
1. Caching all zip entries of WAR.
2. Usage of "java.util.jar.ZipFile.getInputStream(ZipEntry)" for faster scanning of nested jar-s.
3. Disabling class scanning on early phase and preventing war scan.

Time:
Deacreased war scanning from 2m 32sec to 0m 3sec.
Comment 2 Radoslav Ivanov CLA 2012-05-15 09:41:21 EDT
Created attachment 215639 [details]
Patch proposal (new)

Few words about new patch proposal - it resembles to the previous one except for more clear approach on getting(decoding) local file path from url with usage of URLDecoder.decode() (if decoding is missing then FileNotFoundException might be thrown on url paths with '%20' (space)) 

- disadvantages of this method - deprecated;
- advantages - 1) delegates to the proposed one (decode(path,enc)) 2) uses default platform encoding 3) does not throw(deals with) UnsupportedEncodingException, because it uses always correct platform default encoding.

Pending unit test(s) for upload.
Comment 3 Radoslav Ivanov CLA 2012-05-30 06:18:08 EDT
Created attachment 216458 [details]
Code coverage
Comment 4 Radoslav Ivanov CLA 2012-05-30 06:19:00 EDT
Created attachment 216459 [details]
Patch and test
Comment 5 Radoslav Ivanov CLA 2012-05-30 06:23:08 EDT
Note the new attachments:
1. "Patch and test" and 
2. "Code coverage" showing 74.6% coverage of the class with new implementation.
Comment 6 Violeta Georgieva CLA 2012-06-05 14:40:40 EDT
The patch was committed. Commit Id 1e1f581a359fc082222cf5f2d70c61a62a9c6a19
Comment 7 Violeta Georgieva CLA 2012-06-05 16:01:13 EDT
Thanks.
The fix will be available in 2.1.0.RC1.
Comment 8 Violeta Georgieva CLA 2012-06-05 16:20:03 EDT
Please confirm that you wrote 100% of the code and you have the right to contribute the code to Eclipse
Comment 9 Radoslav Ivanov CLA 2012-06-06 02:50:20 EDT
I confirm that I wrote 100% of the code and I have the right to
contribute the code to Eclipse
Comment 10 Violeta Georgieva CLA 2012-06-06 02:51:39 EDT
Thanks