Posted By:
Hendrik_Gani
Posted On:
Monday, November 9, 2009 06:30 AM
Hi, Summary of issue: When running a CPU-intensive program, I am getting large performance overhead (which cannot be reproduced consistently but occassionally appears) on Sun JDK 6. But the overhead does not exist when running the same program on Sun JDK 1.4. Please let me know of any possible causes. Thanks. Details: I have got a simple program in which a method containing an empty loop is executed. The number of the times the loop gets executed was calibrated so that the method executes for approximately 1000 milliseconds (i.e. 1 second). The problem is that sometimes the method executes for 1500-1600 milliseconds instead. This can only be reproduced if I rerun the pro
More>>
Hi,
Summary of issue:
When running a CPU-intensive program, I am getting large performance overhead (which cannot be reproduced consistently but occassionally appears) on Sun JDK 6. But the overhead does not exist when running the same program on Sun JDK 1.4. Please let me know of any possible causes. Thanks.
Details:
I have got a simple program in which a method containing an empty loop is executed. The number of the times the loop gets executed was calibrated so that the method executes for approximately 1000 milliseconds (i.e. 1 second).
The problem is that sometimes the method executes for 1500-1600 milliseconds instead. This can only be reproduced if I rerun the program again without changing the code, opening/closing heavy applications (e.g. eclipse), rebooting the machine. But say if I add a println() statement AFTER the loop, the problem disappears but will eventually reappear (e.g. if the code gets changed again, etc.).
I am sure that this has nothing to do with garbage collection or any external programs contending for CPU, because of the following reasons:
- I ran the program on quad-core and dual-core machines so any external activities should be handled by the other CPU core(s)
- I have monitored running processes and there does not seem to be significant external interference
- I don't think garbage collection can slow down my program so significantly since the program does not have many objects
- More importantly, ThreadMXBean.getCurrentThreadCPUTime() returns me a value of 1500 or 1600 milliseconds, which pretty much says that the thread's CPU usage fluctuates (as opposed to being affected by external threads/processes).
The problem exists when using Sun JDK versions 1.6.0_14 and 1.6.0_17 (on both Windows XP and Vista), but does not happen when using Sun JDK 1.4 (1.4.2_14).
Anyone has any idea why? Does this have anything to do with the profiling or JMX support in later versions of Java runtime environment? Is there any way to fix this?
Thanks,
Hendrik
<<Less