I'm wondering if anyone has come across (or has done) research into theories regarding optimal thread counts for thread pools in Java. Given that an application may well run on a variety of different hardware platforms with very different on-chip MT approaches, different cache schemes and sizes, not to mention differing SMP implementations, how does one determine a reasonably optimal number of threads to spawn for pools where work units are isolated (and thus do not deadlock due to starvation) and could potentially be spread across a large (say, fifty plus) number of threads. I'm sure Sun would have us wave our hands at this and base it on the profile of the work being executed. That's probably the best policy in most cases. But I wonder, in a performance critical scenario, is this the best we can do? Is there a single, "optimal compromise", or should hardware be interrogated at startup? While writing this, it occurs to me that this might be a good fit for genetic programming, thoughts?
Joined: Jan 05, 2001
I think you would waste more cycles monitoring and determining these statistics than you would benefit from them.