Friday, December 08, 2006

Are you suffering from using Dojo in Grails ?

Everything works fine for Grails 0.3.1 when I'm not using Dojo.
But after I'm using it with Grails, I'm suffering from the 100% CPU usage.
This performance hit's caused by Jetty (Grails' default server) is trying to response Dojo files.

From my understanding, it might be that
1. Jetty in Grails distribution has not been configured for this purpose ? or
2. It's normal that a Servlet container's not good at serving a big static file ?

Anyway, I still don't know what's going on inside the container, but I've got a workaround for this problem.
My current solution is to use lighttpd as the front server to serve this Dojo monster ;)
I connect lighttpd with Grails' server using the mod_proxy.
Here's my current config in \etc\lighttpd.conf


proxy.server = ( "/" =>
( "127.0.0.1" =>
(
"host" => "127.0.0.1",
"port" => 8080
)
)
)



Then you need to put your Dojo files into the \htdocs, and correct all script's references in your GSP pages.
Lighttpd uses the default 80 port. So, you just point your browser to http://127.0.0.1//, every should work correctly.

IMO, this solution should work for the production phase as well.

No comments: