Emmanuel, is there a line test tool for Mina? I ask because seems like the
Jedi Jin here has a throughput problem.

Jin,
Have you tried benchmarking your code directly?  In all reality I process
30k sockets and 500mb/s using raw TCP in java so if there is a problem it
is either your code or Mina.
Hi there,

I am using Apache Mina to develop a TCP server that handles incoming XML
messages. There is around 60 to 80 concurrent messages sending to TCP
server per minute. If the messages below 60 the TCP server is working fine
and there is no delay receiving the request but problem arises when more
than 60.

 The problem is the messages didn't reach/receive on time. From the log
file I can see the messages are "accumulated" some where and after a while
(between 10 to 30 seconds) all accumulated messages release to TCP server.
Messages reach server on time is very critical in my application.

I try to fine tune the NioSocketAcceptor number of thread, increase read
buffer size, increase io buffer size but all do not help.

I executed a stress test on my local machine using Jmeter with same
throughput and the result is still negative. When NioSocketAcceptor starts
"accumulating" messages I can see Jmeter is throwing:
jmeter.protocol.tcp.sampler.TCPSampler:  java.net.SocketException: Software
caused connection abort: socket write error.
To me this look like NioSocketAcceptor is blocking the messages. After a
while it back to normal again.

Please take note the JMeter and TCP Server are running on the same machine
 - this is to isolate network factor when doing testing. From the result,
seem like it is not something related to network so now I am just focus on
fine tuning the NioSocketAcceptor.

Below is my codes. I will be grateful if anyone can tell me what is going
on internally. I have been stuck in this problem for few months but still
can't find any solution.

IoAcceptor acceptor = new NioSocketAcceptor();

     // Handle the incoming XML message
     PMMessageHandler pmMessageHandler = new PMMessageHandler();

        // Initialise Spring configuration
        PMUtils pmUtils = PMUtils.getInstance();

pmMessageHandler.setDataProcessor((DataProcessor)pmUtils.getBean("dataProcessor"));

//pmMessageHandler.setPmManager((PMManager)pmUtils.getBean("pmManager"));
        acceptor.setHandler(  pmMessageHandler );

// Set the filter chain for log and translate incoming message to char
             acceptor.getFilterChain().addLast( "logger", new
LoggingFilter() );
        TextLineCodecFactory textLineCodecFactory = new
TextLineCodecFactory(Charset.forName( "UTF-8" ));

textLineCodecFactory.setDecoderMaxLineLength(PMServer.maxLineLength);
        acceptor.getFilterChain().addLast( "codec", new
ProtocolCodecFilter( textLineCodecFactory ));

// Configure buffer size
IoBuffer buffer = IoBuffer.allocate(5120, false);
buffer.setAutoExpand(true);



        try {

         // Configure a port for TCP listener
        acceptor.bind( new InetSocketAddress(PMServer.port));

Thanks,
KJ

Reply via email to