[ace-users] Question of Reactors' implementation

Mai Haohui ricetons at gmail.com
Sat Aug 4 04:10:35 CDT 2007

Hi all,


         Currently I'm working on a HTTP server based on ACE, and I found
that the implementation of TP Reactor on ACE 5.5.10 might cause some
problems when there're many connections.


The implementation of dispatch_i() is the following (simplified):


this->handle_timer_events (event_count, guard);

this->handle_notify_events (event_count, guard);

this->handle_socket_events (event_count, guard);



I have to register a timeout event on the reactor when a new connection
comes, in order to disconnect it when it is idle. However, the strategy
might be buggy considering the following timing sequence:


Connection A comes

Connection B comes

The peer of connection B send some data

Handle_events() ( Invoke handle_input() to process B's request)

The peer of connection A send some data

A timeout

Handle_events() ( Invoke handle_timeout() for A)


We can see that the request from connection A is lost. When the server has
many connections and limited threads for handling them, it seems that the
sequence above happens occasionally, which is frustrating for a HTTP server,
making HTTP client gets nothing.


It seems that making handle_socket_events() comes first in dispatch_i()
would solve the problem. But I also noticed that Prof. Schmidt once
mentioned the primary concern of the implementation is to maximize the
throughput, yet it would be useful for TCP server to change the priority of
the events for better services.


The comments of ACE 5.5.1 says that introducing an Strategy class would
solve problem, but those comments are gone in ACE 5.5.10. Does it means that
the problem is solved?


The e-mail seems a bit long L, thanks for reading it, any comments would be
appreciated J




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20070804/85b9ccec/attachment.htm

More information about the Ace-users mailing list