Le 2/23/14 2:52 PM, Max Larsson a écrit : > Hi, > > >> The logs i based my investigation on are from a a stress test. And >>> the external measurement has the same result. >>> >>> Actually the timing from receiving,proceesing,session.write the >>> commands >>> is very constant on my side (~2ms). The time between session.write and >>> messageSent event is normally about 70ms, but sometime the elapsed >>> time is very low (~2ms). And because the aim is to reach a complete >>> command/response cycle within 10ms, i'm trying to figure out why >>> mina is taking so long to process from session.write to messageSent. >> >> Can you tell us a bit more on : >> - the OS you are running (client and server) >> - the network bandwith >> - the message (received and sent) size >> >> 2ms is slow if you transit small messages. FTR, on a 10 Mbs network, you >> should be able to transmit 10000 messages of 100 bytes per second, mor >> or less, with a latency below 1ms. And 70ms is extremelly slow... > > The message response is about 300-400 bytes, no really big. The received > command even more less ~100 bytes. The network is 100Mbs.
That means you should be able to transmit at least 10 000 message per second. > > The stress test was made with two different setup one being a MacBookPro > 2011 with our software running under Mac OS 19.1. And a windows laptop > with a virtual machine running a linux application, doing the same task, > as our implementation. (Our application shall replace the linux one). > > And the device we are talking to is a printer, later a bit more > information. > The linux app performed twice as any request per minutes, than our. > So i don't think the network setup is the bottleneck (yet) It shuld not be. Now, have you tried to run your app on a server which mimic the printer ? > > I donn't even think the different OSes are a cause. It have to do > somethink with my code and/or how i uses mina. See below. > >> FYI, I'm able to handle more than 13 000 LDAP message per second on a >> 100 Mb/s network, on a 2011 MacBookPro... > > I only have to reach 8000 messages per / *minute* :-) So should be > a task doable. > > A little Background: > > The printer send upon each print cycle the following command: > > Print Triggered -> Started -> Ended > > 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) > As state already > session.write -> NioPorcessor messageSent takes about 70ms. Have you enabled the Nagle algorithm ? Are you using half-duplex network ? > > 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. > > Best regards > > Max Larsson > > > > > > > > -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
