You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Kumaran Arul <AK...@woolworths.com.au> on 2007/04/27 03:41:50 UTC

Please help using MINA in a large mission critical project

Hi

Any hints will be really appreciated.  I am using MINA 1.1.0 and carrying out some performance tests.


When I run the client and the server on the same machine it performs lot better than having both the client and the server on separate machines?


Also if I hit the server with 100 concurrent requests straight away it stalls with 100% CPU utilization. But if I send a first single request and subsequently send 100 concurrent requests it works fine.

My code is show below. Any recommendations or suggestions will be greatly appreciated.



Thanks
ak


P PLEASE CONSIDER THE ENVIRONMENT BEFORE YOU PRINT THIS E-MAIL

>  -----Original Message-----
> From: 	Kumaran Arul  
> Sent:	Tuesday, 24 April 2007 6:32 PM
> To:	'dev@mina.apache.org'
> Subject:	CPU usage 100%
> Importance:	High
> 
> 
> Hi
> 
> I am using MINA 1.1.0 and works well in Windows environment when I use 200 concurrent requests. Takes 0.45ms per request.
> 
> 
> But when I deployed my application to the HP UX machine it runs fast for first 100 requests and the CPU gets to 100% and slows the whole application down drastically (i.e. 30 seconds a request). Any suggestions will be greatly appreciated.
> 
> 
> I am running with 15-25 worker threads 
> and IOThreads = number of CPUs
> 
> 
> Sample code  below:
> 
>             ExecutorService ioExecutor = Executors.newFixedThreadPool(noOfIoThreads + 1);
> 
> 		ExecutorService serviceExecutor = Executors.newFixedThreadPool(noOfWorkerThreads);
> 
> 		IoAcceptor acceptor = new SocketAcceptor(noOfIoThreads, ioExecutor);
> 		SocketAcceptorConfig config = new SocketAcceptorConfig();
> 
> 		config.setThreadModel(ThreadModel.MANUAL);
> 		config.getSessionConfig().setTcpNoDelay(false);
> 		config.getSessionConfig().setReuseAddress(true);
> 		
> 		DefaultIoFilterChainBuilder chain = config.getFilterChain();
> 		addLogger(chain);
> 		// config.getFilterChain().addLast("compression", new CompressionFilter());
> 		config.getFilterChain().addLast("threadPool", new ExecutorFilter(serviceExecutor));
> 		
> 		SocketAddress sa = null;
> 
> 		try {
> 			sa = new InetSocketAddress(portNo);
> 			//
> 			
> 			//Bind
> 			acceptor.bind(sa, new PayAtPumpTxnHandler(), config);
> 		}
> 
> 		catch (IOException ioe) {
> 			acceptor.unbind(sa);
> 			serviceExecutor.shutdown();
> 			ioExecutor.shutdown();
> 			throw new RuntimeException("Error starting the listener " + listenerName + " on host=" + ((InetSocketAddress)sa).getHostName() +   " on port number=" + portNo + ioe);
> 		}
> 
> 		finally {
> 			logger.info("Listener " + listenerName + " started on host=" +  ((InetSocketAddress)sa).getHostName() +   " port number=" + portNo);
> 		}
> 
> 
> 
> 
> 
> P PLEASE CONSIDER THE ENVIRONMENT BEFORE YOU PRINT THIS E-MAIL
> 

***********************************************************
CAUTION: This email and files included in its transmission 
are solely intended for the use of the addressee(s) and may 
contain information that is confidential and privileged. 
If you receive this email in error, please advise us 
immediately and delete it without copying the contents 
contained within. Woolworths Limited (including its group 
of companies) do not accept liability for the views 
expressed within or the consequences of any computer 
viruses that may be transmitted with this email. The 
contents are also subject to copyright. No part of it 
should be reproduced, adapted or transmitted without the 
written consent of the copyright owner.
***********************************************************

Re: Please help using MINA in a large mission critical project

Posted by peter royal <pr...@apache.org>.
On Apr 27, 2007, at 3:41 AM, Kumaran Arul wrote:
> When I run the client and the server on the same machine it  
> performs lot better than having both the client and the server on  
> separate machines?

sure, since the OS is probably smart enough to realize its a local  
socket connection and optimize things. There's no network involved! :)

> Also if I hit the server with 100 concurrent requests straight away  
> it stalls with 100% CPU utilization. But if I send a first single  
> request and subsequently send 100 concurrent requests it works fine.

This is starting "cold"?

When performance testing java projects, its critical to provide a  
"warm up" period to allow the JVM to have a chance to load and  
initialize all code, as well as optimize the bytecodes (by converting  
to native code in most cases)

> My code is show below. Any recommendations or suggestions will be  
> greatly appreciated.

It looks okay at first blush.

-pete



-- 
proyal@apache.org - http://fotap.org/~osi