Haes
Haes

Reputation: 13116

Updating from Java 1.4.2 to Java 6 (both Sun VMs) results in slower performance

I've just upgraded some old Java source which has been running on a Sun Java 1.4.2 VM to Sun Java (JRE) 6 VM. More or less the only thing I had to change was to add explicit datatypes for some abstract objects (Hashmap's, Vector's and so on). The code itself it quite memory intensive, using up to 1G of heap memory (using -Xmx1024m as a parameter to start the VM).

Since I read alot about better performance on newer Java VM's, this was one of the reasons I did this upgrade.

  1. Can anyone think of a reason why the performance is worse in my case now (just in general, of course, since you can't take a look at the code)?
  2. Has anyone some advice for a non Java guru what to look for if I wanted to optimize (speed wise) existing code? Any hints, recommended docs, tools?

Thanks.

Upvotes: 2

Views: 808

Answers (4)

Ken Liu
Ken Liu

Reputation: 22914

Definitely use a profiler on the app (YourKit is great)...it's easy to waste a lot of time guessing at the problem when most of the time you'll be able to narrow it down really quickly in the profiler.

Upvotes: 0

kohlerm
kohlerm

Reputation: 2624

Theoretically it could be that you application consumes more memory, because there were changes to the way Strings share their internal char[]. Less sharing is done after 1.4. Check my old blog at http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5100 (new blog is here)

I would compare the Garbage Collector logs to see whether memory usage is really the problem.

If that doesn't help, us a profiler such as Yourkit to find the differences.

Upvotes: 3

mfx
mfx

Reputation: 7388

If your application nearly runs out of free space, garbage collection time may dominate computation time.

Enable gc debugging to look for this. Or, even better, simply start jconsole and attach it to your program.

Upvotes: 3

Nikhil Kashyap
Nikhil Kashyap

Reputation: 1029

Not much information here. But here are a couple of things you might want to explore:

  • Start the VM with Xmx and Xms as the same value (in your case 1024M)

  • Ensure that the server jvm dll is being used to start the virtual machine.

  • Run a profiler to see what objects are hogging memory or what objects are not being garbage collected

  • Hook up your VM with the jconsole and trace through the objects

Upvotes: 7

Related Questions