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