users@grizzly.java.net

Comet - growing CPU usage

From: FredrikJ <fredrik_at_robotsociety.com>
Date: Mon, 8 Jun 2009 05:08:24 -0700 (PDT)

Hi.
I am currently load testing a Comet application running on Glassfish 2.1.
When running longer tests I noticed that the CPU was steadily rising. After
a while the CPU would hit 100% and then OOM's etc. would start to happen. I
started to shave off unknown parts until I could get pinpoint what causes
this, and the result is as below.

This is my web application (Servlet), the simplest possible implementation:

public class HelloWorldServlet extends HttpServlet {
        @Override
        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
                resp.getWriter().write("Hello world");
        }
}

The servlet does not take advantage or reference Comet at all. With this
application deployed we applied 200 request/second for the HelloWorld.

This is the CPU usage with Comet disabled:
http://www.nabble.com/file/p23922811/cpu_comet_disabled.png

This is the CPU usage with Comet enabled:
http://www.nabble.com/file/p23922811/cpu_comet_enabled.png

It is pretty obvious that the CPU usage is much higher with Comet enabled
and also show a growing trend. If we plot the CPU with the heap usage we get
this:
http://www.nabble.com/file/p23922811/cpu_comet_enabled-cpumem.png

It seems that the CPU follows the heap size, but does not recover completely
with the gc's.

I am going to perform some more analysis, but I would like to know if this
is known/documented/expected etc. behavior?

I can turn this on and off by enabling/disabling Comet. Am I misusing Comet
by doing this? Do I have to have special Comet handling in my servlet if I
turn it on? If no, then this seems like inproper behavior, if yes, then
what?





-- 
View this message in context: http://www.nabble.com/Comet---growing-CPU-usage-tp23922811p23922811.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.