[concurrency-interest] Single producer, single consumer: unexpected delays for producer
gregg at cytetech.com
Tue Aug 12 16:42:14 EDT 2008
Daniel Harvey wrote:
> Having tested today, I found that performing:
> for (;;) queue.take();
> causes very little more contention that the best scenario, and much less
> than when the socket.write() is being performed.
Have you tried putting another queue in place to send the writes off to another
thread? This would let you have more than one thread doing encodes() and might
actually allow some overlapping I/O and CPU too, which will be a throughput
I also didn't see whether you had used CTRL-\ or kill -3 <jvmpid> to get some
stack traces to see if they revealed the threads always "stuck" at the same
spot, or perhaps a "waiting to lock" state that might indicate, better, what the
contentious resource is.
More information about the Concurrency-interest