users@grizzly.java.net

Re: Comet - growing CPU usage

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 08 Jun 2009 12:36:33 -0400

Salut,

FredrikJ wrote:
> 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.

Are you suspending connections but not resuming them? That would explain
the grow.


>
> 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.

Hum. I've fixed something like that in 0.27. Can you download 1.0.29
from here:

http://download.java.net/maven/2/com/sun/grizzly/grizzly-framework-http/1.0.29/

edit your domain.xml and add the jar to you classpath-prefix so this
version of Grizzly gets used when starting 2.1

Thanks

-- Jeanfrancois


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?
>
>
>
>
>