Using thread inter-communication to increase my server app's IO throughput; not sure how

Posted by Howard Guo on Stack Overflow See other posts from Stack Overflow or by Howard Guo
Published on 2012-09-26T07:07:42Z Indexed on 2012/09/26 9:38 UTC
Read the original article Hit count: 272

Filed under:

My server application creates a new thread for each incoming connection. Incoming requests are serialized in a BlockingQueue. There is one worker thread taking items from the queue, produce a response and send the response through socket.

I have noticed a throughput issue: Currently, worker thread is responsible of sending the response message through socket, thus severely wasting processing power and throughput.

I am considering: rather than sending the response itself, why not telling network IO threads to send the response?

However, when I think about thread inter-communication, I cannot yet figure out how to approach it: Worker thread will produce a response, but how will it inform the response message to IO thread?

Is there a standard/best practice?

Thank you.

© Stack Overflow or respective owner

Related posts about java