Java Random Slowdowns on Mac OS cont'd

Posted by javajustice on Stack Overflow See other posts from Stack Overflow or by javajustice
Published on 2009-11-15T20:12:03Z Indexed on 2010/05/30 0:02 UTC
Read the original article Hit count: 307

Filed under:
|
|
|
|

I asked this question a few weeks ago, but I'm still having the problem and I have some new hints. The original question is here:

http://stackoverflow.com/questions/1651887/java-random-slowdowns-on-mac-os

Basically, I have a java application that splits a job into independent pieces and runs them in separate threads. The threads have no synchronization or shared memory items. The only resources they do share are data files on the hard disk, with each thread having an open file channel.

Most of the time it runs very fast, but occasionally it will run very slow for no apparent reason. If I attach a CPU profiler to it, then it will start running quickly again. If I take a CPU snapshot, it says its spending most of its time in "self time" in a function that doesn't do anything except check a few (unshared unsynchronized) booleans. I don't know how this could be accurate because 1, it makes no sense, and 2, attaching the profiler seems to knock the threads out of whatever mode they're in and fix the problem. Also, regardless of whether it runs fast or slow, it always finishes and gives the same output, and it never dips in total cpu usage (in this case ~1500%), implying that the threads aren't getting blocked.

I have tried different garbage collectors, different sizings the parts of the memory space, writing data output to non-raid drives, and putting all data output in threads separate the main worker threads.

Does anyone have any idea what kind of problem this could be? Could it be the operating system (OS X 10.6.2) ? I have not been able to duplicate it on a windows machine, but I don't have one with a similar hardware configuration.

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading