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

azathoth jebarker at gmail.com
Sat Nov 3 13:42:50 CDT 2007

On Nov 2, 6:29 pm, schm... at dre.vanderbilt.edu (Douglas C. Schmidt)
> Hi,
> >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
> Ok, that makes sense so far.
> >If I set the buffer to quite large, say 8192 bytes I can transfer
> >100mb through this system in a couple of seconds.
> BTW, what do you mean by "the buffer" - do you mean the ACE_Message_Block?

> >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.
No, it uses the reactor the same amount. The ACE_Message_Queue is used
as a fallback if the ACE_Message_Block gets full. If the 'buffer gets
full it just puts all the data in the queue, when handle_output is
called it sends all the data it can from both the buffer and the
queue. handle_output is called the same number of times regardless of
method used.

> Sure, that makes sense since you're going through the Reactor
> repeatedly, which will take more time.
> Thanks,
> Doug
> --
> Dr. Douglas C. Schmidt                       Professor and Associate Chair
> Electrical Engineering and Computer Science  TEL: (615) 343-8197
> Vanderbilt University                        WEB:www.dre.vanderbilt.edu/~schmidt
> Nashville, TN 37203                          NET: d.schm... at vanderbilt.edu

More information about the Ace-users mailing list