ASIO or Thread

View: New views
6 Messages — Rating Filter:   Alert me  

ASIO or Thread

by Lloyd K L :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

______________________________________
Scanned and protected by Email scanner
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: ASIO or Thread

by OvermindDL1 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 5, 2009 at 11:09 PM, Lloyd <lloyd@...> 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.

Since you generally use ASIO *with* Threads, I would imagine that
would be best, and if you set it up asynchronously, then I would say
that the number of threads equaling the number of CPU cores in the
computer would be best.  Might wait for an expert though.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: ASIO or Thread

by Jonathan Franklin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 7, 2009 at 6:34 PM, OvermindDL1 <overminddl1@...> wrote:
> On Thu, Nov 5, 2009 at 11:09 PM, Lloyd <lloyd@...> wrote:
>>  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).
<snip>
> Since you generally use ASIO *with* Threads, I would imagine that
> would be best, <snip>

Yeah, the question is more like:
Should I use ASIO+Threads, or just ASIO?

> and if you set it up asynchronously, then I would say
> that the number of threads equaling the number of CPU cores in the
> computer would be best.

I'm betting your performance will be bound by disk IO, unless your
link throughput is ridiculously low.  Either way, since you're
expecting relatively few simultaneous connections, I'm not sure that
extra threads beyond what the ASIO io_service uses will buy you
anything.

But you should always benchmark to be sure.

Jon
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: ASIO or Thread

by Nigel Rantor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lloyd 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.

I would suggest you write a first draft, or spike solution, to test
speed and then do some calculations to see whether or not the speed is
acceptable for your problem before looking for optimisation hints.

Regards,

   n
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: ASIO or Thread

by Scott Gifford :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lloyd <lloyd@...> writes:

>    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?

Hi Lloyd,

ASIO can do its work in any number of worker threads, and you can
adjust the number of worker threads without too much work, so it
should be easy to experiment.

Hope this helps,

-----Scott.
_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Re: ASIO or Thread

by Zachary Turner-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Fri, Nov 6, 2009 at 12:09 AM, Lloyd <lloyd@...> 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.

_______________________________________________
Boost-users mailing list
Boost-users@...
http://lists.boost.org/mailman/listinfo.cgi/boost-users