Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] io_service threadpool performance
From: Vjekoslav Brajkovic (balkan_at_[hidden])
Date: 2009-03-13 19:06:24


> Dear all,

Hi!

> posting
> 10 M jobs to the io_service, and starting N threads at io_service::run
> after that. Timings below are measured on an 8-core machine, I would expect

I suppose you are the one instantiating the connection.

I had the same exact symptoms a week ago... not sure if this is the same
problem. However instead of using threadpool, I was using
thread_group(). The pseudo code looked something like this:

for (int i = 0; i < n; i++) {
   tg.create(bind(io_service::run, io_service_));
}

Performance was pretty poor... so to fix the issue, all I had to do was
add usleep(1000) before each call. Just for reference, it tool 13sec to
transfer a 1GB file, instead of 50.

I haven't had time to investigate what was causing the issue.

HTH. :)
vjeko

> the execution performance to improve (not to get worse) for execution by
> more threads. Posting to the io_service is done single-threaded, so these
> timings should remain approx. the same. Please find attached the test
> program. Is there something I've missed and/or should tweak to get the
> desired improvement per added thread?
>
> Many thanks,
> Kind regards,
>
> Rutger ter Borg
>
>
>
>
> Concurrency = 1
> Finished posting after: 3.15
> Finished execution after: 5.44
> Execs / sec: 1e+07/2.29=4.36681e+06
> Concurrency = 2
> Finished posting after: 2.85
> Finished execution after: 5.47
> Execs / sec: 1e+07/2.62=3.81679e+06
> Concurrency = 3
> Finished posting after: 3.15
> Finished execution after: 11.65
> Execs / sec: 1e+07/8.5=1.17647e+06
> Concurrency = 4
> Finished posting after: 3.15
> Finished execution after: 9.8
> Execs / sec: 1e+07/6.65=1.50376e+06
> Concurrency = 5
> Finished posting after: 3.28
> Finished execution after: 12.45
> Execs / sec: 1e+07/9.17=1.09051e+06
> Concurrency = 6
> Finished posting after: 3.29
> Finished execution after: 8.84
> Execs / sec: 1e+07/5.55=1.8018e+06
> Concurrency = 7
> Finished posting after: 3.51
> Finished execution after: 10.09
> Execs / sec: 1e+07/6.58=1.51976e+06
> Concurrency = 8
> Finished posting after: 3.38
> Finished execution after: 12.54
> Execs / sec: 1e+07/9.16=1.0917e+06
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net