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/24 10:31:48 UTC
CPU usage 100%
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: CPU usage 100%
Posted by mat <fo...@gmail.com>.
Did you put:
ByteBuffer.setUseDirectBuffers(false); // Direct buffers perform bad.
ByteBuffer.setAllocator(new SimpleByteBufferAllocator()); // Disables
pooling.
It helps.
2007/4/24, Kumaran Arul <AK...@woolworths.com.au>:
>
>
> 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: CPU usage 100%
Posted by Jannie Pieterse <pe...@gmail.com>.
I have not found a open source or freeware profiler. But i must recommend
JProfiler.
Jan
On 4/30/07, Mark Webb <el...@gmail.com> wrote:
>
> Peter,
>
> Do you use YourKit with an open source licence?
>
> --
> ..Cheers
> Mark
>
>
> On 4/29/07, peter royal <pr...@apache.org> wrote:
> > On Apr 27, 2007, at 5:37 PM, mat wrote:
> > > Which one (profiler) do you recommend?
> >
> > I'm a big fan of YourKit, http://yourkit.com/
> >
> > -pete
> >
> >
> >
> > --
> > proyal@apache.org - http://fotap.org/~osi
> >
> >
> >
> >
> >
>
Re: CPU usage 100%
Posted by peter royal <pr...@apache.org>.
On Apr 30, 2007, at 3:32 PM, Mark Webb wrote:
> Do you use YourKit with an open source licence?
No, I've been having my employer furnish me with a copy for the past
few years as I find it very useful for my dayjob work as well :)
-pete
--
proyal@apache.org - http://fotap.org/~osi
Re: CPU usage 100%
Posted by Mark Webb <el...@gmail.com>.
Peter,
Do you use YourKit with an open source licence?
--
..Cheers
Mark
On 4/29/07, peter royal <pr...@apache.org> wrote:
> On Apr 27, 2007, at 5:37 PM, mat wrote:
> > Which one (profiler) do you recommend?
>
> I'm a big fan of YourKit, http://yourkit.com/
>
> -pete
>
>
>
> --
> proyal@apache.org - http://fotap.org/~osi
>
>
>
>
>
Re: CPU usage 100%
Posted by peter royal <pr...@apache.org>.
On Apr 27, 2007, at 5:37 PM, mat wrote:
> Which one (profiler) do you recommend?
I'm a big fan of YourKit, http://yourkit.com/
-pete
--
proyal@apache.org - http://fotap.org/~osi
Re: CPU usage 100%
Posted by mat <fo...@gmail.com>.
Which one (profiler) do you recommend?
2007/4/24, Vinod Panicker <vi...@gmail.com>:
>
> On 4/24/07, Kumaran Arul <AK...@woolworths.com.au> wrote:
> >
> > 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 guess the best thing would be to profile the app to find out where
> the CPU time is being spent.
>
> Regards,
> Vinod.
>
Re: CPU usage 100%
Posted by Vinod Panicker <vi...@gmail.com>.
On 4/24/07, Kumaran Arul <AK...@woolworths.com.au> wrote:
>
> 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 guess the best thing would be to profile the app to find out where
the CPU time is being spent.
Regards,
Vinod.