You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by VJDBC Support <vj...@gmx.net> on 2007/03/18 18:34:23 UTC
Behaviour of Session-Writes
Hi,
first of all, I wanted to thank the MINA team for giving us a framework
of such great quality and elegance. MINA enabled me to convince
management to go the 3-tier route using MINA in the middle tier.
Stunning performance and stability, our test server now runs for months
without any problems.
Now my question: I understood that the data that is written back via
session.write(...) can arrive at the client in multiple packages,
depending on how TCP manages the output buffer. But is it ensured by
MINA that the data of several session.write(...)-Calls is delivered in
sequence ? Let's say I have a big Response-A (100k) and a small
Response-B (1k) object that I write into the session. First I write
Response-A into the session, then Response-B. Can I expect that
Response-A is delivered completely (probably in multiple packages)
before Response-B comes in ?
Bye,
Michael
Re: Behaviour of Session-Writes
Posted by Niklas Therning <ni...@trillian.se>.
VJDBC Support wrote:
> Hi,
>
> first of all, I wanted to thank the MINA team for giving us a
> framework of such great quality and elegance. MINA enabled me to
> convince management to go the 3-tier route using MINA in the middle
> tier. Stunning performance and stability, our test server now runs for
> months without any problems.
>
> Now my question: I understood that the data that is written back via
> session.write(...) can arrive at the client in multiple packages,
> depending on how TCP manages the output buffer. But is it ensured by
> MINA that the data of several session.write(...)-Calls is delivered in
> sequence ? Let's say I have a big Response-A (100k) and a small
> Response-B (1k) object that I write into the session. First I write
> Response-A into the session, then Response-B. Can I expect that
> Response-A is delivered completely (probably in multiple packages)
> before Response-B comes in ?
>
Yes, MINA will write Respone-A completely to the underlying socket
before Response-B is written. After that TCP will of course take care of
delivering it in the same order on the other side.
TCP may chop your data up into smaller pieces or combine it into larger
chunks as it sees fit. Because of this you must make sure your code
works even if, e.g., the last 1k of Response-A and the first 100 bytes
of Response-B is delivered in a single ByteBuffer on the receiving side.
HTH
--
Niklas Therning
www.spamdrain.net