Asynchronous socket operations and threadpool



Dear All,

I have a general question regarding the best practice for using asynchronous
socket operations and threadpool.

It often happens that I need to perform lenghty operations after
asynchronous receive/send/accept. These operations themselves are often
composed of multiple atom operations which can be completed asynchronously.
For example, upon accepting a connection I might want to lookup the remote
host using dns, and then send/receive some data. These things must be
completed in order (e.g. have to wait for dns to finish before sending).

My question is this:

I understand that the callbacks are queued and executed on a threadpool
thread, which is limited in quantity. I believe that this will become a
bottle neck of my application if the subsequent actions are done in a
synchronous fasion. Should I simply increase the number of thread pool
threads (which is easy) or should I make everything asynchronous? What will
be the complications if I simply increase the number of threadpool threads?

Many thanks in advance!

Li



.


Loading