You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Cleber Cassol <cc...@gmail.com> on 2010/03/26 15:35:04 UTC
High CPU usage with MINA 1.1.7 - a.k.a. How to properly configure the
IoProcessor threads
Hello again.
Thank you in advance for your great support so far. As you may well
remember, I was having a memory leak issue with MINA 1.1.7, but managed to
solve it thanks to your insights. Now, I have a differente problem to deal
with: sometimes, under not so heavy load (about 2 requests per second), the
server CPU goes to 50%, 60% and sometimes to 100% usage. It stays there for
some minutes, and then it goes down again for the normal level of 5-10%.
So, my question is: Is there a general rule for configuring the IoProcessor
and IoHandler threads? Our app is configured this way:
IoProcessor for Acceptor and Connector: 5 (our server CPU has a quadcore
processor)
IoHandler threadpool: minimum 5, maximum 10 for request and response
IoHandlers (2 threadpools configured)
Based on that configuration, is there a reason for those CPU usage bursts?
How can I tune that? I've profiled our application using VisualVM and got
the following results: http://yfrog.com/bfprofilingp The image shows that
more than 90% of CPU time is being used by MINA.
Thanks in advance for any help.
Regards.
Re: High CPU usage with MINA 1.1.7 - a.k.a. How to properly configure
the IoProcessor threads
Posted by Cleber Cassol <cc...@gmail.com>.
That's the problem: our clients don't behave correctly. Being a proxy for an
IMAP server, most of our clients are cell phones. And here in Brazil our 3G
isn't that good, so I get many "Connection reset by peer" errors all the
time. Even though I close the sessions correctly (that's the main reason our
memory leak problem doesn't occur anymore), our client's behavior will
always be erratic.
I'll take a look at those issues. Thanks again.
Regards.
2010/3/26 Emmanuel Lécharny <el...@apache.org>
> On 3/26/10 3:54 PM, Cleber Cassol wrote:
>
>> Merci, Emmanuel.
>>
>>
> De rien ...
>
> Is there any workaround available? Or the workaround is switching to MINA
>> 2.0?
>>
>>
> The first step would be to be sure that the problem is really the spinning
> selector.
>
> There is no workaround but switchng to 2.0.0. You may avoid such problem
> thiugh if the sessions are correctly closed, and if your clients behave
> correctly, as it's a race condition (see
> https://issues.apache.org/jira/browse/DIRMINA-678,
> https://issues.apache.org/jira/browse/DIRMINA-681 and
> http://bugs.sun.com/view_bug.do?bug_id=6403933)
>
> In 2.0.0-RC1, when we met this kind of problem, we ditch the selector and
> register all the keys on a new selector.
>
>
> --
>
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.nextury.com
>
>
>
--
Abraços!
Re: High CPU usage with MINA 1.1.7 - a.k.a. How to properly configure
the IoProcessor threads
Posted by Emmanuel Lécharny <el...@apache.org>.
On 3/26/10 3:54 PM, Cleber Cassol wrote:
> Merci, Emmanuel.
>
De rien ...
> Is there any workaround available? Or the workaround is switching to MINA
> 2.0?
>
The first step would be to be sure that the problem is really the
spinning selector.
There is no workaround but switchng to 2.0.0. You may avoid such problem
thiugh if the sessions are correctly closed, and if your clients behave
correctly, as it's a race condition (see
https://issues.apache.org/jira/browse/DIRMINA-678,
https://issues.apache.org/jira/browse/DIRMINA-681 and
http://bugs.sun.com/view_bug.do?bug_id=6403933)
In 2.0.0-RC1, when we met this kind of problem, we ditch the selector
and register all the keys on a new selector.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com
Re: High CPU usage with MINA 1.1.7 - a.k.a. How to properly configure
the IoProcessor threads
Posted by Cleber Cassol <cc...@gmail.com>.
Merci, Emmanuel.
Is there any workaround available? Or the workaround is switching to MINA
2.0?
Regards.
2010/3/26 Emmanuel Lecharny <el...@gmail.com>
> On 3/26/10 3:35 PM, Cleber Cassol wrote:
>
>> Hello again.
>>
>> Thank you in advance for your great support so far. As you may well
>> remember, I was having a memory leak issue with MINA 1.1.7, but managed to
>> solve it thanks to your insights. Now, I have a differente problem to deal
>> with: sometimes, under not so heavy load (about 2 requests per second),
>> the
>> server CPU goes to 50%, 60% and sometimes to 100% usage. It stays there
>> for
>> some minutes, and then it goes down again for the normal level of 5-10%.
>>
>>
> It may be caused by the selector() bug : sometime, under some specific
> condition, the selector() methods returns immediately as if some sockect is
> ready to be read, but without any socket ready. The problem is that in this
> case, we renter into the selector() method immediately, and you can see that
> it sucks 100% CPU very quickly.
>
> This problem has been fixed in 2.0.0-RC1.
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.nextury.com
>
>
>
--
Abraços!
Re: High CPU usage with MINA 1.1.7 - a.k.a. How to properly configure
the IoProcessor threads
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/26/10 3:35 PM, Cleber Cassol wrote:
> Hello again.
>
> Thank you in advance for your great support so far. As you may well
> remember, I was having a memory leak issue with MINA 1.1.7, but managed to
> solve it thanks to your insights. Now, I have a differente problem to deal
> with: sometimes, under not so heavy load (about 2 requests per second), the
> server CPU goes to 50%, 60% and sometimes to 100% usage. It stays there for
> some minutes, and then it goes down again for the normal level of 5-10%.
>
It may be caused by the selector() bug : sometime, under some specific
condition, the selector() methods returns immediately as if some sockect
is ready to be read, but without any socket ready. The problem is that
in this case, we renter into the selector() method immediately, and you
can see that it sucks 100% CPU very quickly.
This problem has been fixed in 2.0.0-RC1.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com