Jan. 8, 2011, 8:38 a.m.
posted by mark
This chapter examined the accidental complexities, sources of performance degradation, and portability problems that arise when designing a networked application using a reactive server model. The ACE_Handle_Set and ACE_Handle_Set_Iterator wrapper facades were described as one way to resolve these problems. These classes help ensure portable and robust server programming without compromising the performance of networked applications.
Reactive servers are a common programming model that allows one server to handle interactions with multiple peers or clients concurrently. Although the new versions of the networked logging server in this chapter showed how easy it is to do so portably, there's still room for further improvement. The example in Section 7.4 decides whether to accept a new connection or receive log records based on whether or not a socket handle is active in an ACE_Handle_Set. Although this design works, it tightly couples the event demultiplexing and connection management code. Application developers are therefore required to rewrite this code, which is actually general purpose and should therefore be refactored into a reusable framework.
The fundamental issue here is that select() and fd_set form the basis for powerful event demultiplexing and event handling capabilities that are hard to encapsulate within a simple wrapper facade. ACE therefore provides a framework based on the Reactor pattern [SSRB00] to refactor and reuse the generic event demultiplexing and dispatching behavior more flexibly. We cover the ACE Reactor framework thoroughly in [SH].