Erinc Arikan wrote:
When I set tcpNodelay to true of socketSessionConfig of the server's
acceptor. I see the exact same timestamp for ACK and Response message in
client logs. But when I set it to false I see 150-200 ms between ACK and
message response although message processing on average takes around 800 ms
You may have to add an executor at the end of your chain so that your
written ACK is sent even if the message is being processed, otherwise
everything will be processed sequentially (ie, when the handler will
have finished to process your messgae, then the thread will be freed,
and the IoPorcessor will be able to send the data, which mean that all
the written bytes are tored and sent at the same time at the end of the
processing).
Here is what I used in Apache DS to fix the exact same problem :
IoFilterChainBuilder chain = new DefaultIoFilterChainBuilder();
// Inject the codec into the chain
((DefaultIoFilterChainBuilder)chain).addLast( "codec",
new ProtocolCodecFilter(
this.getProtocolCodecFactory() ) );
// Now inject an ExecutorFilter for the write operations
// We use the same number of thread than the number of
IoProcessor
((DefaultIoFilterChainBuilder)chain).addLast( "executor",
new ExecutorFilter(
new UnorderedThreadPoolExecutor(
transport.getNbThreads() ),
IoEventType.MESSAGE_RECEIVED ) );
/*
* The server is now initialized, we can
* install the default requests handlers, which need
* access to the DirectoryServer instance.
*/
installDefaultHandlers();
startNetwork( transport, chain );
...
Just give it a try.
PS : *please*, when you post a mail on this ML, just consider providing
information about the MINA version you are using. The way MINA 1.0, MINA
1.1 and MINA 2.0 behave is really different. Thanks !
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org