Hi Geoff,

Thank you!

Following is my JDK version and OS version.

$ java -version
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_10-b03, mixed mode)
$ uname -a
Linux ....... 2.6.18-4-amd64 #1 SMP Fri May 4 00:37:33 UTC 2007 x86_64
GNU/Linux

I will try your method and report again. I should use following command to
run my program, right?
$ java
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.EPollSelectorProvider
...


Geoff Cadien wrote:
> 
> On 7/25/07, McEase <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi all,
>>
>> I have a server program based on mina which provides services to clients
>> and
>> also acts as a client of other servers. I found that when there're lots
>> of
>> client come and request a service and go (at a moment, there aren't so
>> many
>> clients), the CPU load of my program is very high. I profiled my program
>> through java's agentlib hprof, like this:
> 
> 
> First let me say that I'm new to MINA myself so take what I have to say
> with
> a grain of salt.  A high cpu load isn't always a bad thing, especially
> since
> you mention you see a high load with lots of clients.
> 
> 
> $ java -agentlib:hprof=cpu=samples,depth=8 -cp $MyClassPath MyClass
>>
>> I got the following results:
>>
>> ......................
>> TRACE 300291:
>>         sun.nio.ch.PollArrayWrapper.poll0(PollArrayWrapper.java:Unknown
>> line)
>>         sun.nio.ch.PollArrayWrapper.poll(PollArrayWrapper.java:100)
> 
> 
> 
> What  JDK version/OS are you using?  I ask because at least on Linux, jdk
> 1.6 uses epoll and not poll.  A later update of jdk 1.5 can also use epoll
> but you have to set the SelectorProvider using a System property.  If you
> are using Linux epoll is much more efficient and might decrease your cpu
> load.
> 
> -geoff
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Why-high-CPU-load--tf4149135s16868.html#a11804375
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to