0

I have Tomcat6 running with Java6. The WebApp that it runs is compiled with Java 6 as well.

At the time being, compiling the WebApp with Java7/8 is not possible, and neither it is migrating to Tomcat7/8. The only possible move is to change Tomcat6's JRE to Java7/8.

Will it improve performance in any way to run that same Tomcat6 with Java7/8? Or, on the contrary, will it cause trouble and/or degrade performance?

Thanks in advance and best regards.

Federico Alvarez
  • 1,459
  • 1
  • 19
  • 30

1 Answers1

1

It makes sense if you are planning to install new applications or recompile the existing. Newer versions of Java are backward-compatible, they bring new language features (Java 7 - multicatch, try with resources, switch-case by String..., Java 8 - Lambdas and Stream API), some security issues are resolved etc., but I honestly doubt that you will experience any performance improvement just by upgrading JRE. Regarding possible risks, applications compiled with older versions of Java should run smoothly on newer JVMs, however if you try the reverse, you will experience famous major.minor version error.

If possible, rather consider upgrading Tomcat to the version 7 at least, it will enable your applications to use e.g. Servlet 3.0 features.

See also:

Community
  • 1
  • 1
Miljen Mikic
  • 14,765
  • 8
  • 58
  • 66
  • Thanks Miljen. Do you have an opinion on memory management, garbage collection or memory leaks? I agree that performance in the WebApp just by upgrading JRE is not likely, but maybe get a "better" JVM in general. Reducing garbage collection times, improving memory management, and such. Thanks again for your time. Best regards, Federico. – Federico Alvarez Aug 07 '15 at 14:20
  • 1
    @FedericoAlvarez You are welcome! Regarding garbage collection and memory management, in JDK 7 new G1 garbage collector is introduced (check http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html), while in JDK 8 there is no PermGen space anymore (check http://stackoverflow.com/questions/18339707/permgen-elimination-in-jdk-8/22509753#22509753). Best regards! – Miljen Mikic Aug 07 '15 at 21:27
  • Thanks a lot. The most important side of this is that there is no "visible" penalty for running java6 compiled code in java8. And perhaps we get a boost from this new garbage collector. So, will give it a try. Thanks again. – Federico Alvarez Aug 09 '15 at 21:28
  • 1
    @FedericoAlvarez - and if you decide one day to recompile your application, the environment will be ready. Good luck! – Miljen Mikic Aug 10 '15 at 08:16