mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Separate Threads for sending and receiving
Date Mon, 24 Feb 2014 07:21:55 GMT
Le 2/24/14 8:06 AM, Max Larsson a écrit :
> Hi,
>>> Upon receiving Started, our app has to to respond with a new
>>> set of data to print. The processing of this takes about ~2ms.
>>> (NioPreccossor recievedMessage -> session.write).
>> you mean it takes 2ms to process a message on your server ? What are you
>> doing during the processing (2ms is a very long period)
> Calculating the next set of data for the printer including some database
> queries.

Ah ! That explains the 2ms then. That does not explain the 70ms needed
to write the data...
>>> As state already
>>> session.write -> NioPorcessor messageSent takes about 70ms.
>> Have you enabled the Nagle algorithm ? Are you using half-duplex
>> network ?
> Full Duplex. setTcpNoDelay is set to true
ok. Eliminated the obvious...

>>> Additional some background how our IoHandler is implemented.
>>> In the messageReceived we check if the message is send to us
>>> as result upon command send to the printer or if it is a message
>>> send to us triggered by a print cycle. If it is from the print cycle
>>> we use another thread to dispatch an internal event in our event.
>>> This thread process the message and prepares the next set of data
>>> to print and writes it with session.write out.
>>> After digging a lot around i have a feeling thats the cause of the
>>> long delay? Because (IMHO) i think during preparing the reponse, the
>>> NioPreccssor Thread keep going, doesn't see anything to write, goes to
>>> check for reading next message and doesn't get the desired attention
>>> when the writeQueue gets filled.
>> As soon as you write something, this will trigger an event which will be
>> processed. There is no delay here.
>> What you should do at this point is to use Wireshark to see what's
>> really going on at the network level. You should be able to see how long
>> it takes to write a response after a request has been received.
> One of the next task this week to check :-)
> But as it seems, at least i'm using mina correctly.

I don't have your code, but yes. I don't see anything atrocious done here.

Have you some log in your code ?

Emmanuel Lécharny

View raw message