
Hi all, This is a question to networking gurus, and is on the edge of being off topic, but I am asking it here because I hope it will help me to better understand rationale behind the asio design... As was stated before, asio is based on the proactor pattern. This pattern is known for its scalability, but is difficult to port since it's based on asynchronous calls which are implemented differently (or not implemented at all) on diferent OSs. OTOH, reactor (the one based on select) seems to be easily portable, and also scalable, but its only real problem is that it doesn't utilise threads, and so it can't take an advantage of multi-processor systems. So my question is, isn't this drawback easily remedied by just placing select-ed sockets into a queue, and having multiple threads (from a thread pool) pick them up and performing the work? Wouldn't this provide comparable performance on multiple processors, with much better portability, than proactor? Thanks, Arkadiy

HI Arkadiy, --- Arkadiy Vertleyb <vertleyb@hotmail.com> wrote:
This is a question to networking gurus, and is on the edge of being off topic, but I am asking it here because I hope it will help me to better understand rationale behind the asio design...
As was stated before, asio is based on the proactor pattern. This pattern is known for its scalability, but is difficult to port since it's based on asynchronous calls which are implemented differently (or not implemented at all) on diferent OSs.
Since asio has a proactor implementation layered on top of a select reactor, I believe it can be just as portable as select is.
OTOH, reactor (the one based on select) seems to be easily portable, and also scalable, but its only real problem is that it doesn't utilise threads, and so it can't take an advantage of multi-processor systems.
So my question is, isn't this drawback easily remedied by just placing select-ed sockets into a queue, and having multiple threads (from a thread pool) pick them up and performing the work? Wouldn't this provide comparable performance on multiple processors, with much better portability, than proactor?
The select reactor and thread pooling implementation inside asio could use some improvement to do just as you describe. The portable ACE-based proactor described at http://www.terabit.com.au/articles.php (from which asio derives many ideas) does this, I believe. Unfortunately the reactor pattern is not as portable as you might think: - On Windows, select is much less efficient than overlapped I/O. An alternative reactor implementation using WaitForMultipleObjects limits you to 64 handles per call. - There are operating systems that provide asynchronous I/O without supporting reactive I/O. Symbian is an example. So in summary, I think proactor is the most portable choice because it can be efficiently implemented in terms of a reactor, but can use native asynchronous I/O when that is more efficient, or indeed the only viable option. Cheers, Chris

So in summary, I think proactor is the most portable choice because it can be efficiently implemented in terms of a reactor, but can use native asynchronous I/O when that is more efficient, or indeed the only viable option.
I just want to add that I think this is the genius of asio compared to other frameworks I've used, and why I am excited about it. For instance libraries like libevent http://www.monkey.org/%7Eprovos/libevent/ do not perform well on Windows because they do reactive I/O using Windows's select(), which was glommed onto the kernel with the BSD TCP/IP code. With proactor there is a good change of ending up with something that performs well on Windows and *nix.

"Christopher Kohlhoff" <chris@kohlhoff.com> wrote in message news:20051222212016.87044.qmail@web32613.mail.mud.yahoo.com...
The select reactor and thread pooling implementation inside asio could use some improvement to do just as you describe. The portable ACE-based proactor described at http://www.terabit.com.au/articles.php (from which asio derives many ideas) does this, I believe.
There is ACE_TP_Reactor in ACE that utilizes a thread pool in the Leader/Followers pattern.
participants (4)
-
Arkadiy Vertleyb
-
christopher baus
-
Christopher Kohlhoff
-
Eugene Alterman