On Fri, Nov 6, 2009 at 12:09 AM, Lloyd <lloyd@cdactvm.in> wrote:

Hi,
 We need to develop a server in a LAN environment, in which the number of connections at a time will be less, but the data traffic per connection will be huge (gigabytes). So for the best performance which library is better? ASIO or Thread?

Is thre is any specif advice for attaining the maximum performace (data rate)? I am a newbie.

Thanks,
 Lloyd

Unless you are doing lots of non-disk related stuff with the data, there is no point in using multiple threads.  What will the threads even do?  disk i/o is issued as an asynchronous system call which returns immediately, so having multiple threads all returning immediately and then waiting for work doesn't serve much purpose.

If, on the other hand, you are doing computation on the data then you can use multiple threads.  I use asio in exactly this way.  One thread doing all the I/O from the disk, then a thread pool of boost::thread::hardware_concurrency() threads encrypting and computing MD5 sums of data, then passing that to the next stage of the pipeline which is back in the original main application thread which dumps it to a socket asynchronously.  So all the i/o (disk / network) is on a single thread, and all the computation is in a thread pool.