Quantcast

Making Grails applications faster or less memory intensive

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Making Grails applications faster or less memory intensive

tomas lin
Hi guys,

I'm in the process of optimizing an existing Grails application that
is running into OutOfMemory exceptions after being deployed.

I spent a few days hacking at the code and profiling with a
combination of VisualVM and JMeter, but haven't really found any place
that makes me go 'aha!'.

I wonder if you have ran into some known memory / performance problems
that could help me make this code leaner and/or faster?

For example, does it make a difference if the bulk of the code was in
services rather than controllers? Would it make sense to rewrite
certain things in Java? Does having multiple levels of GSPs affect
performance vs. just one? Does taglibs and scriplets matter? Should we
increase VM Parameters, change garbage collection parameters, increase
PermGenSpace? Do Request Filters do more harm than good? Do uninvoked
plugins sit there as memory leeches?

Basically, I'm looking for any tips that you might have to make our
Grails code more efficient and/or less memory intensive. I know that
Sky uses Grails to serve a lot of their high volume websites, but it
seems that this information is not readily available, so any tips and
patterns for improving speed or performance will be greatly
appreciated.

Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

Dean Del Ponte-2
How much memory have you allocated to the server?

On Thu, Jul 30, 2009 at 4:47 PM, Tomas Lin <[hidden email]> wrote:
Hi guys,

I'm in the process of optimizing an existing Grails application that
is running into OutOfMemory exceptions after being deployed.

I spent a few days hacking at the code and profiling with a
combination of VisualVM and JMeter, but haven't really found any place
that makes me go 'aha!'.

I wonder if you have ran into some known memory / performance problems
that could help me make this code leaner and/or faster?

For example, does it make a difference if the bulk of the code was in
services rather than controllers? Would it make sense to rewrite
certain things in Java? Does having multiple levels of GSPs affect
performance vs. just one? Does taglibs and scriplets matter? Should we
increase VM Parameters, change garbage collection parameters, increase
PermGenSpace? Do Request Filters do more harm than good? Do uninvoked
plugins sit there as memory leeches?

Basically, I'm looking for any tips that you might have to make our
Grails code more efficient and/or less memory intensive. I know that
Sky uses Grails to serve a lot of their high volume websites, but it
seems that this information is not readily available, so any tips and
patterns for improving speed or performance will be greatly
appreciated.

Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Making Grails applications faster or less memory intensive

Frohnhofer, James
In reply to this post by tomas lin
+1

-----Original Message-----
From: Tomas Lin [mailto:[hidden email]]
Sent: Thursday, July 30, 2009 5:48 PM
To: [hidden email]
Subject: [grails-user] Making Grails applications faster or less memory
intensive

Hi guys,

I'm in the process of optimizing an existing Grails application that is
running into OutOfMemory exceptions after being deployed.

I spent a few days hacking at the code and profiling with a combination
of VisualVM and JMeter, but haven't really found any place that makes me
go 'aha!'.

I wonder if you have ran into some known memory / performance problems
that could help me make this code leaner and/or faster?

For example, does it make a difference if the bulk of the code was in
services rather than controllers? Would it make sense to rewrite certain
things in Java? Does having multiple levels of GSPs affect performance
vs. just one? Does taglibs and scriplets matter? Should we increase VM
Parameters, change garbage collection parameters, increase PermGenSpace?
Do Request Filters do more harm than good? Do uninvoked plugins sit
there as memory leeches?

Basically, I'm looking for any tips that you might have to make our
Grails code more efficient and/or less memory intensive. I know that Sky
uses Grails to serve a lot of their high volume websites, but it seems
that this information is not readily available, so any tips and patterns
for improving speed or performance will be greatly appreciated.

Thanks.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




PLEASE READ: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please delete it and all copies from your system, destroy any hard copies and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Nomura Holding America Inc., Nomura Securities International, Inc, and their respective subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state the views of such entity. Unless otherwise stated, any pricing information in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

tomas lin
In reply to this post by Dean Del Ponte-2
Very little - we're running in a constrained environment of less than
300 megs, but it's not really a big app - no hibernate, no complicated
logic. It's written as a gateway to more complicated java web services
hosted elsewhere. The heap is usually half full. What's concerning is
that there are a lot of uncollected objects in memory that seem to
accumulate over time and seem to overwhelm the PermGem space.

I understand that groovy 1.6. has increased memory requirements due to
call-site caching ( thanks to a convo with Graeme ). But this doesn't
really seem to be our problem. The heap is never dangerously full.
What we're seeing with some pages is that they are slow, but respond
after a while. It only seems to crash with some pages that pull in
external xml files.

I can't believe I just typed that and it makes sense to me.

On Thu, Jul 30, 2009 at 10:54 PM, Dean Del Ponte<[hidden email]> wrote:

> How much memory have you allocated to the server?
>
> On Thu, Jul 30, 2009 at 4:47 PM, Tomas Lin <[hidden email]> wrote:
>>
>> Hi guys,
>>
>> I'm in the process of optimizing an existing Grails application that
>> is running into OutOfMemory exceptions after being deployed.
>>
>> I spent a few days hacking at the code and profiling with a
>> combination of VisualVM and JMeter, but haven't really found any place
>> that makes me go 'aha!'.
>>
>> I wonder if you have ran into some known memory / performance problems
>> that could help me make this code leaner and/or faster?
>>
>> For example, does it make a difference if the bulk of the code was in
>> services rather than controllers? Would it make sense to rewrite
>> certain things in Java? Does having multiple levels of GSPs affect
>> performance vs. just one? Does taglibs and scriplets matter? Should we
>> increase VM Parameters, change garbage collection parameters, increase
>> PermGenSpace? Do Request Filters do more harm than good? Do uninvoked
>> plugins sit there as memory leeches?
>>
>> Basically, I'm looking for any tips that you might have to make our
>> Grails code more efficient and/or less memory intensive. I know that
>> Sky uses Grails to serve a lot of their high volume websites, but it
>> seems that this information is not readily available, so any tips and
>> patterns for improving speed or performance will be greatly
>> appreciated.
>>
>> Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

Wolfgang Schell
In reply to this post by tomas lin
Hi!

tomas lin wrote
I'm in the process of optimizing an existing Grails application that
is running into OutOfMemory exceptions after being deployed.
I would suggest creating a heap dump on OOM Exceptions (see http://wiki.eclipse.org/index.php/MemoryAnalyzer#Getting_a_Heap_Dump) and use a tool like Eclipse Memory Analyzer (http://www.eclipse.org/mat/) to find the root cause. The website has several examples (see Wiki and Blog) on how to do this.

HTH,

Wolfgang
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

tomas lin
Yup, we've done this. The problem is that the app freezes/crashes so
hard that it's often very difficult to get the perfect snapshot.

We're taking two routes to solve this problem, one is to try to catch
the memory thief in the act, but the other is really to write better
Grails code so that there is less leakage / performance issues. Hence
the main question in this thread.

I guess what I'm looking for is to try to compile a list for grails
performance and memory use similar to this one for Flex :
http://www.insideria.com/2009/04/51-actionscript-30-and-flex-op.html ,
I don't know if that makes sense

On Thu, Jul 30, 2009 at 11:17 PM, Wolfgang Schell<[hidden email]> wrote:

>
> Hi!
>
>
> tomas lin wrote:
>>
>> I'm in the process of optimizing an existing Grails application that
>> is running into OutOfMemory exceptions after being deployed.
>>
>
> I would suggest creating a heap dump on OOM Exceptions (see
> http://wiki.eclipse.org/index.php/MemoryAnalyzer#Getting_a_Heap_Dump) and
> use a tool like Eclipse Memory Analyzer (http://www.eclipse.org/mat/) to
> find the root cause. The website has several examples (see Wiki and Blog) on
> how to do this.
>
> HTH,
>
> Wolfgang
>
> --
> View this message in context: http://www.nabble.com/Making-Grails-applications-faster-or-less-memory-intensive-tp24747930p24748241.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

Lari Hotari -
In reply to this post by tomas lin
Tomas Lin wrote:
> I wonder if you have ran into some known memory / performance problems
> that could help me make this code leaner and/or faster?
>
>  
For profiling the execution of Grails/Groovy, you can try the JIP
profiler: http://jiprof.sourceforge.net/ . JRuby folks seem to use JIP
for profiling JRuby (--profile flag ,
http://www.infoq.com/news/2008/05/jruby-roundup-1.1.1-gsoc-speed ).

I used this kind of JIP configuration (profile.properties) for profiling
grails:
profiler=off
remote=on
port=15599
thread-depth=-1
thread.compact.threshold.ms=10
method.compact.threshold.ms=10
file=./profile.txt
track.object.alloc=off
output=both
debug=off
profiler-class=com.mentorgen.tools.profile.runtime.Profile
output-method-signatures=no
clock-resolution=ms
max-method-count=50
output-summary-only=yes
accept-class-loaders=org.codehaus.groovy.grails.cli.support.GrailsRootLoader,org.codehaus.groovy.tools.RootLoader
exclude=org.mortbay

You might have to tune the configuration to get proper results in your case.
(mini tutorial about JIP usage in a recent blog posting:
http://www.platypusinnovation.com/view?id=139)

My earlier post about JIP to this list:
http://www.nabble.com/profiling-grails-cpu-usage,-what-are-the-best-tools--td23555879.html

There are a couple of JIRAs related to performance/memory usage that
might interest you:
http://jira.codehaus.org/browse/GROOVY-3557 (not fixed in stable groovy
releases yet)
http://jira.codehaus.org/browse/GRAILS-2890 ,
http://jira.codehaus.org/browse/GRAILS-3392 (included in Grails 1.2-M1)
http://jira.codehaus.org/browse/GRAILS-4315 (included in Grails 1.1.1)

Please test with Grails 1.2-M1 in war deployed mode too since it
includes a major change in GSP execution (GRAILS-2890).


Regards,

Lari

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Making Grails applications faster or less memory intensive

Björn Wilmsmann-2
In reply to this post by tomas lin

Tomas Lin wrote:

> What we're seeing with some pages is that they are slow, but respond
> after a while. It only seems to crash with some pages that pull in
> external xml files.


How complex are those files? Maybe, the XML files are processed with  
an XmlSlurper, potentially creating a very complex tree.

--
Best regards,
Bjoern Wilmsmann




PGP.sig (201 bytes) Download Attachment
Loading...