multi-threading cpu-bound app not utilizing 100% cpu
807588Jan 26 2009 — edited Jan 26 2009I'm running a multi-threaded application which is cpu-intensive, although some io-operations occur. (i.e: some small mysql selects)
my problem is that on my test server (intel core2 duo 6400 3gb Ram on Windows XP SP3) cpu utilization is on average:
1 thread --> ~47%
2 threads --> ~76%
4 threads --> ~82%
I thought perhaps some io-operations were in the way, but checking with getThreadCpuTime and getThreadUserTime (through threadMXBean-methods)
I checked that indeed the application is cpu-bound by comparing thread -user time with thread cpu time (of threadMXBean-class) , but this only gives small difference (which is used for other things such as IO if I'm correct. Please correct if I'm wrong on this)
total cpu %: 77.3384452964383
total user %: 76.34939156526089
the threads share some final static fields which is all. No synchronization or anything. (I'm seeing no blocks and waittime is only a couple of milliseconds using threadMxBean-class)
Basically what Im looking for are some common practice pointers as what could be causing this to happen.
Sadly, I'm not able to supply the code, but of course can supply extra info if needed.
Thanks in advance,
Brits