You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Jacob Barrett <Ja...@attachmatewrq.com> on 2006/01/12 19:21:40 UTC

MINA ProtocolEncoder Strangeness

I am seeing a massive slow down in performance when making a change that
I figured should improve performance.  I might be completely
misunderstanding what is going on though.

I have a ProtocolEncoder that like a ByteBuffer of header information
gathered from the message it is encoding.  In the message object there
is also a ByteBuffer of content.  When I put the content puffer into the
header buffer and write that to the ProtocolEncoderOutput object I can
achieve about 200KB/s throughput (there are other slowdowns unrelated to
this).  What boggles me is when rather than putting the content buffer
into header buffer I just simply write both buffers to the out it slows
down to 4KB/s.  My thinking is that this should be more efficient
because I am not moving the contents of one buffer to another buffer
(about 1K worth of bytes) to just output both buffers anyway.  Now from
what I understand both ByteBuffers are put in the ProtocolEncoderOutput
queue and written out in order just as if the headers and contents were
in one buffer.  Is this not the case?  Is something more going on when
multiple ByteBuffers are put in the queue this way?

Thanks,
Jake

Re: MINA ProtocolEncoder Strangeness

Posted by Trustin Lee <tr...@gmail.com>.
Hi Jacob,

I'm sorry for the late response first of all.  I hope you didn't
disappointed with our silence to your message.

2006/1/13, Jacob Barrett <Ja...@attachmatewrq.com>:
>
> I am seeing a massive slow down in performance when making a change that
> I figured should improve performance.  I might be completely
> misunderstanding what is going on though.
>
> I have a ProtocolEncoder that like a ByteBuffer of header information
> gathered from the message it is encoding.  In the message object there
> is also a ByteBuffer of content.  When I put the content puffer into the
> header buffer and write that to the ProtocolEncoderOutput object I can
> achieve about 200KB/s throughput (there are other slowdowns unrelated to
> this).  What boggles me is when rather than putting the content buffer
> into header buffer I just simply write both buffers to the out it slows
> down to 4KB/s.  My thinking is that this should be more efficient
> because I am not moving the contents of one buffer to another buffer
> (about 1K worth of bytes) to just output both buffers anyway.  Now from
> what I understand both ByteBuffers are put in the ProtocolEncoderOutput
> queue and written out in order just as if the headers and contents were
> in one buffer.  Is this not the case?  Is something more going on when
> multiple ByteBuffers are put in the queue this way?


This is apparently strange behavior.  Are you on Windows platform?  I once
saw that Windows notifies the VM that the write buffer is ready too lately.
If you can reproduce this problem easily, we could test it by ourselves (if
setting up the testing process is easy enough).

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
PGP Key ID: 0x854B996C