Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow Dynamic GSP Reloading in Production on AIX

We are using Grails 2.2.4, WebSphere 8.0.0.5 all running on AIX 6.1.0.0. Websphere is using the IBM JDK:

Java(TM) SE Runtime Environment (build pap6460_26sr3ifix-20121005_02(SR3+IV27268+IV27928+IV28217+IV25699))

IBM J9 VM (build 2.6, JRE 1.6.0 AIX ppc64-64 20120919_122629 (JIT enabled, AOT enabled)

J9VM - R26_Java626_SR3_iFix_1_20120919_1316_B122629

JIT - r11.b01_20120808_24925ifx1

GC - R26_Java626_SR3_iFix_1_20120919_1316_B122629 J9CL - 20120919_122629)

JCL - 20120713_01

The problem is that using:

grails.gsp.enable.reload = true
grails.gsp.view.dir="/path/to/gsp/views"

is slow, and by that I mean a good 20 seconds to render a small GSP. What's interesting is that in our local development environments it takes 2 seconds.

We've isolated this problem by having a controller that does nothing except call render(..) on a blank GSP with nothing in the model, so I can only assume it's the compilation but I could be wrong.

Has anyone come across other instances where rendering GSPs is extremely slow, or have any suggestions, perhaps it's some sort of weird JDK issue on AIX?

In addition to the bounty, whoever answers this correctly gets free waffles.

EDIT Just noticed this the other day: there are three environments with the same WAS config and setup and one of them works fine, so it is definitely some sort of environment issue.

like image 800
Alex Beardsley Avatar asked Jul 31 '13 14:07

Alex Beardsley


2 Answers

I agree with your suspicion that it's compilation time. Perhaps you grails.gsp.view.dir is slow - a networked file system perhaps?

The real answer, unfortunately, is to not enable GSP reload in production. It's clearly meant as a development convenience, and is not intended to perform well in production.

like image 112
GreyBeardedGeek Avatar answered Sep 19 '22 12:09

GreyBeardedGeek


Make sure sitemesh is being preprocessed

grails.views.gsp.sitemesh.preprocess=true

Also I suspect this to be locking issue rather than compiling issue.

To at least reduce this problem set the following configs

grails.gsp.reload.interval= time in milliseconds.

something high depending on your comfort. Perhaps every hour?

If your file is changing the last modified time too quickly you need to lower the granularity by

grails.gsp.reload.granularity= Time in milliseconds. 

Limit the number of classes being reloaded by

grails.reload.excludes 

and

grails.reload.includes

Also remember the view path MUST end in slash. I didn't see that in the example you provided.

like image 29
Ganesh Krishnan Avatar answered Sep 20 '22 12:09

Ganesh Krishnan