[Ace-users] Using ACE_Svc_Handler::msg_queue() for buffering is slow

azathoth jebarker at gmail.com
Fri Nov 2 11:44:51 CDT 2007


Hi guys,

I've got a simple class that inherits from ACE_Svc_Handler like so:

class StreamHandler :
  public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> {

which has a basic method write(buf, bytes) that puts the bytes
supplied in an ACE_Message_Block and if that fills up it buffers them
in the message queue. The handle_output method will try to write as
much to the socket as possible until it has used up all the bytes in
the queue and buffer, or until the send() command fails (because of
blocking). If it has sent all bytes it clears the wakeup handler
WRITE_MASK.

If I set the buffer to quite large, say 8192 bytes I can transfer
100mb through this system in a couple of seconds. Whenever the
ACE_Message_Queue is used it uses exponentially more time. If I say
restrict the buffer to 10 bytes for instance it will take 2 minutes to
transfer 100mb.

The methods for manipulating the queue like is_empty,
peek_dequeue_head, dequeue_head etc don't seem to be taking any time
in themselves. The handle_output method itself seems to be barely run.
In fact when the queue is being used the process is basically idle.

It's almost as if using the queue is causing the Reactor to notify
objects with a significant delay? Using ACE_NULL_MUTEX so there
shouldn't be any synchronization overhead.

We're using ACE 5.5 on linux platform with all default settings.



More information about the Ace-users mailing list