Boost logo

Boost Users :

Subject: [Boost-users] [asio] io_service threadpool performance
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2009-03-13 17:32:19


Dear all,

I have been testing asio's io_service in a threadpool setup for job
dispatching. However, it seems as if adding threads doesn't improve
performance; perhaps even the opposite with 1 thread having the best
performance. See below for some results of a simple test I'm doing, 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
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