Boost logo

Boost :

From: Dean Michael C. Berris (dmberris_at_[hidden])
Date: 2008-02-28 02:24:07

Hi everyone,

Has there been a formal comparison between the performance of an
application having one io_service per core compared to a single io
service run by a thread pool?

Currently I'm implementing a server that will be run on a machine with
multiple processors. My main concerns are that in the case of a single
io service run by a thread pool, handler functions are wrapped in a
strand therefore causing (unnecessary) synchronization between the
running threads. In the case of an io service per core design,
unbalanced work from connections being serviced by one io service
instance over the others will cause that one thread (presumed to be
running on just one processor) to do most of the work leaving the other
threads idle.

I'm mainly interested in a pro-cons discussion on what the best approach
should be. Currently, my implementation uses a single io service with a
thread pool running handlers synchronized with a strand -- though the
performance is OK, I'm looking at whether trying the other approach
would be worth it.

Comments and insights would be most appreciated.

Dean Michael Berris
Software Engineer, Friendster, Inc.

Boost list run by bdawes at, gregod at, cpdaniel at, john at