Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build times increase substantially when switching to Java 7

We use Java within our build process, as it is used to resolve/publish our dependencies via Ivy.

No problem, nor have we had with it for 2 years, until we've tried to upgrade Java 6 Update 26 to Version 7 Update 7, whereas a build on a local developer PC (WinXP) now takes 2 hours to complete, instead of 10 minutes!!

Nothing else has changed on the PC, making it the absolute target for our concerns.

Does anyone know of any reason as to why version 7 of Java would make such a speed difference like this?

UPDATE: The build process is NAnt-based, so Java.exe is called from a NAnt script, running in a Command (DOS) window.

like image 304
Brett Rigby Avatar asked Sep 26 '12 15:09

Brett Rigby


3 Answers

I'm using JDK 7u7 and I noticed a better performance by tuning some VM Options.

You could try the G1GC and AgressiveOpts to help with compile time.

Follow the settings I use in my editor:

-Xss8m 
-Xmn256m 
-Xms512m 
-Xmx1024m 
-XX:PermSize=256m 
-XX:MaxPermSize=512m 
-XX:+UseG1GC 
-XX:+OptimizeStringConcat 
-XX:+UseStringCache 
-XX:+AggressiveOpts

You will find each option's description in the VM Options link.

I hope it helps.

like image 56
rbento Avatar answered Nov 18 '22 05:11

rbento


In my experience, Java 7 was a huge step backward in terms of speed and compatibility. I've found it slower not only to compile, but running the JRE as well.

I've also had major issues running eclipse with it (and yes, i've used update 7).

And from my standpoint there's nothing in Java 7 that i need. I like the ForkJoinPool, and can get that as an add on library for Java 6.

Maybe Java 8 will be better.

like image 1
Matt Avatar answered Nov 18 '22 04:11

Matt


First, did you remove JDK6 or leave it in place? Check your JDK_HOME and any other place it is specified to ensure that you are actually using JDK7. In the XP console type java -version and ensure it is what is expected. (Close/reopen the command prompt to pick up changes in the Win GUI.)

It was never stated what version of XP you are running -- 64-bit or 32-bit. Ensure the appropriate JDK environment is on the machine. (Depending on exactly what is executing, this can make a tangible difference. Also, the best bet for debugging is to keep it the same as before -- reduce variables.)

Troubleshoot the issue and narrow it down. Does an Eclipse installation perform slower after the upgrade? (Eclipse itself runs in a JVM. It's a good baseline.) Is Eclipse pointing at the correct JDK when you test it? Try other Java tools to see if there is a performance difference. Breakpoints and logging at different control points in the build and any Java executables are your friends.

Since Nant is .NET based, have you looked at the Java process that is actually launched? Is your Ivy distribution really old?

All this said, it is hard for me to believe this is a Java issue and not a configuration challenge on the Windows box. Have you tried it on any other machines, anyway?

like image 1
ingyhere Avatar answered Nov 18 '22 05:11

ingyhere