[concurrency-interest] ThreadPoolExecutor workQueue concurrency issue
holger at wizards.de
Tue Dec 11 03:33:21 EST 2007
Guy Korland wrote:
> We built an application in a SEDA fashion, working in stages from one
> ThreadPool to another.
> We found out that the BlockingQueue used by the ThreadPoolExecutor
> became a major concurrency killer when we start working on 4 cores
> machines and above.
Well, one could argue that that is sort of the point of a blocking queue. :)
> The thing is that we don't really need the strong FIFO behavior forced
> by all the BlockingQueue implementations available, some kind of
> fairness will be good enough.
> Any ideas?
If you just need handoff and have fixed-size (or growth-controlled) pools
then SynchronousQueue will probably work; in Mule we default to it as long
as no explicit queue size has been configured. If you really need a "true"
blocking queue try LinkedBlockingDeque, which should have less contention.
Unfortunately it is only in 1.6 or the backport, but not in 1.5..
More information about the Concurrency-interest