You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ing. Andrea Vettori" <ma...@andreavettori.com> on 2007/06/17 19:08:00 UTC
[S2] App generate lot (2GB) of garbage!
Hi,
I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an e-
commerce site.
I have the following problem.
The app seems to generate lot of garbage in RAM (young gen) that the
gc correctly collects.
But when there is more than a few users on the site, that amount of
garbage is generated about every 10 seconds or less depending on the
number of users. This cause a lot of cpu usage...
Tracking the memory usage with the hprof agent I found that a lot of
memory is used by freemarker.* classes on HashMaps.
I have devMode turned off, have the "template" dir on the root of the
war file and I have the freemarker.properties file into the classes
dir inside WEB-INF with template_update_delay=60000.
Any hint on WHY the application is generating such big amount of
garbage ?
Thank you
Here is top memory usage and relative traces :
bytes 192,090,608
obj number: 1,263,754
class: java.util.HashMap$Entry[]
TRACE 352396:
java.util.HashMap.<init>(HashMap.java:203)
freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
bytes: 143,560,048
obj number: 944,474
class: java.util.HashMap$Entry[]
TRACE 352387:
java.util.HashMap.<init>(HashMap.java:203)
freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
freemarker.ext.beans.MapModel.<init>(MapModel.java:105)
bytes: 141,327,104
obj number: 2,208,236
class: java.util.HashMap
TRACE 352386:
java.util.AbstractMap.<init>(AbstractMap.java:53)
java.util.HashMap.<init>(HashMap.java:200)
freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Thanks
In fact they are already there! I made a mistake writing the email...
Il giorno 27/giu/07, alle ore 22:05, Guillaume Carré ha scritto:
> 2007/6/23, Ing. Andrea Vettori <ma...@andreavettori.com>:
>> yes the templates are into
>>
>> WEB-INFO/templates
>
> you have to put them in tour WEB-APP root, meaning the directory
> directly above WEB-INF
>
> Freemarker won't find the templates in your WEB-INF directory, meaning
> freemarker won't cache them
> you might get a performance boost and less generated garbage by
> putting the templates in the right directory...
> --
> Guillaume Carré
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Guillaume Carré <gu...@gmail.com>.
2007/6/23, Ing. Andrea Vettori <ma...@andreavettori.com>:
> yes the templates are into
>
> WEB-INFO/templates
you have to put them in tour WEB-APP root, meaning the directory
directly above WEB-INF
Freemarker won't find the templates in your WEB-INF directory, meaning
freemarker won't cache them
you might get a performance boost and less generated garbage by
putting the templates in the right directory...
--
Guillaume Carré
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
yes the templates are into
WEB-INFO/templates
Il giorno 23/giu/07, alle ore 11:28, Guillaume Carré ha scritto:
> 2007/6/23, Ing. Andrea Vettori <ma...@andreavettori.com>:
>> So struts asks freemarker to generate the html for the struts tag.
>> Freemarker looks at the template and outputs the html based on it.
>> Freemarker is caching the template in memory to not have to read them
>> from the disk every time.
>
> freemarker caches the templates only if there are in the WEB_APP root,
> have you copied the /template directory from the struts2 jar there?
>
> see: http://struts.apache.org/2.x/docs/performance-tuning.html
> --
> Guillaume Carré
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Guillaume Carré <gu...@gmail.com>.
2007/6/23, Ing. Andrea Vettori <ma...@andreavettori.com>:
> So struts asks freemarker to generate the html for the struts tag.
> Freemarker looks at the template and outputs the html based on it.
> Freemarker is caching the template in memory to not have to read them
> from the disk every time.
freemarker caches the templates only if there are in the WEB_APP root,
have you copied the /template directory from the struts2 jar there?
see: http://struts.apache.org/2.x/docs/performance-tuning.html
--
Guillaume Carré
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
It's because the complete link ends with trace1.html
The email program truncated the link into two lines...
Thank you!
Il giorno 25/giu/07, alle ore 09:42, Al Sutton ha scritto:
> Just went to look at the full trace and got a;
>
> Forbidden
> You don't have permission to access /trace/ on this server.
>
>
>
> -----Original Message-----
> From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
> Sent: 25 June 2007 08:34
> To: Struts Users Mailing List
> Subject: Re: [S2] App generate lot (2GB) of garbage!
>
> Hi,
>
> I've run a profile with yourkit (nice!) on my development platform.
> Here is the most important evidence. I've opened three product
> listings and
> a couple of product sheet in my site. Total garbage collected : 234
> MB.
>
> Of these 234 MB, 64 are produced by
> org.jboss.remoting.transport.socket.ServerThread.run() so they are
> related
> to communication between the business layer and the presentation
> layer.
>
> Most of the other (156MB) are produced by
> com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's
> something
> related to struts.
>
> Going down the stack trace through interceptors the "last class" is
> org.apache.struts2.dispatcher.StrutsResultSupport.execute
> (ActionInvocation) that has 146MB of generated garbage.
>
> Now the interesting part :
>
> These 146MB are divided into :
>
> 34MB generated by freemarker.template.Template.process(Object,
> Writer) 22MB
> generated by
> com.opensymphony.xwork2.util.OgnlValueStack.findValue(String)
> 10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile
> (ICompilationUnit[])
> 7MB generated by freemarker.template.Configuration.getTemplate(String)
> 6MB generated by org.eclipse.jdt.internal.compiler.Compiler.<init>
> (INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor,
> IProblemFactory, boolean)
>
> and a few other with less then 3MB each.
>
> You can find the complete trace on http://www.andreavettori.com/trace/
> trace1.html.
>
> Do they seems normal numbers ???
> I also don't understand if the difference between 146 and about 90
> (=34+22+10+7+6+other small) is produced by
> org.apache.struts2.dispatcher.StrutsResultSupport.execute
> (ActionInvocation). That's over 50MB!
>
> Now if someone think that this can help solve my problem and
> understand
> where is produced this garbage I can run the same profile on the
> production
> server, maybe for a couple of minutes.
>
> I'm also really interested into knowing if you guys have ever
> checked gc
> collections on your applications... I don't think I'm the only one
> that
> writes "garbage producer applications" :).
>
> Thank you and please don't leave me alone with this problem!
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: [S2] App generate lot (2GB) of garbage!
Posted by Al Sutton <al...@alsutton.com>.
Just went to look at the full trace and got a;
Forbidden
You don't have permission to access /trace/ on this server.
-----Original Message-----
From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
Sent: 25 June 2007 08:34
To: Struts Users Mailing List
Subject: Re: [S2] App generate lot (2GB) of garbage!
Hi,
I've run a profile with yourkit (nice!) on my development platform.
Here is the most important evidence. I've opened three product listings and
a couple of product sheet in my site. Total garbage collected : 234 MB.
Of these 234 MB, 64 are produced by
org.jboss.remoting.transport.socket.ServerThread.run() so they are related
to communication between the business layer and the presentation layer.
Most of the other (156MB) are produced by
com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's something
related to struts.
Going down the stack trace through interceptors the "last class" is
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation) that has 146MB of generated garbage.
Now the interesting part :
These 146MB are divided into :
34MB generated by freemarker.template.Template.process(Object, Writer) 22MB
generated by
com.opensymphony.xwork2.util.OgnlValueStack.findValue(String)
10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile
(ICompilationUnit[])
7MB generated by freemarker.template.Configuration.getTemplate(String)
6MB generated by org.eclipse.jdt.internal.compiler.Compiler.<init>
(INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor,
IProblemFactory, boolean)
and a few other with less then 3MB each.
You can find the complete trace on http://www.andreavettori.com/trace/
trace1.html.
Do they seems normal numbers ???
I also don't understand if the difference between 146 and about 90
(=34+22+10+7+6+other small) is produced by
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation). That's over 50MB!
Now if someone think that this can help solve my problem and understand
where is produced this garbage I can run the same profile on the production
server, maybe for a couple of minutes.
I'm also really interested into knowing if you guys have ever checked gc
collections on your applications... I don't think I'm the only one that
writes "garbage producer applications" :).
Thank you and please don't leave me alone with this problem!
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Martin Gainty <mg...@hotmail.com>.
(Tomcat specific) LambdaProbe
http://www.lambdaprobe.org/d/index.htm
A number of Memory Profiler Utilities available here
http://www.java-source.net/open-source/profilers
HTH
M-
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Ing. Andrea Vettori" <ma...@andreavettori.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Cc: "Al Sutton" <al...@alsutton.com>
Sent: Monday, June 25, 2007 12:40 PM
Subject: Re: [S2] App generate lot (2GB) of garbage!
> >
>> I'll now try to profile the production server for a longer time and
>> keep you informed.
>>
>
> Unfortunately the garbage is still produced. But I can't profile the
> production server because the profiler crashes!
>
> Can anyone suggest a product to get the complete allocation object
> list ?
>
> Maybe in the meantime the yourkit guys resolve the problem but I
> really want to leave this problem behind as soon as possibile!
>
> Thank you
>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage! SOLVED
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 30/giu/07, alle ore 13:54, Dave Newton ha scritto:
> --- "Ing. Andrea Vettori" wrote:
>> However, my code still benefit a lot from disabling
>> logging of struts \classes in jboss and caching the
>
>> freemarker BeanWrapper.
>>
>> Hope to see this in the PerformanceTuning wiki
>> pages.
>
> Logging and template caching, at least, are already on
> the tuning page.
yes, logging is cited but a couple more lines on how to disable it on
log4j will be helpful to many.
And I don't mean template caching but BeanWrapper model caching
that's not enabled by default and moreover it does not exist a struct
option to enable (jira already opened).
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage! SOLVED
Posted by Dave Newton <ne...@yahoo.com>.
--- "Ing. Andrea Vettori" wrote:
> However, my code still benefit a lot from disabling
> logging of struts \classes in jboss and caching the
> freemarker BeanWrapper.
>
> Hope to see this in the PerformanceTuning wiki
> pages.
Logging and template caching, at least, are already on
the tuning page.
d.
____________________________________________________________________________________Ready for the edge of your seat?
Check out tonight's top picks on Yahoo! TV.
http://tv.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage! SOLVED
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
As the last try to solve the problem I upgraded jboss to 4.2.0GA.
This upgraded hibernate also.
Solved.
It seems that there was something in jboss and/or hibernate that
produced the garbage forever...
However, my code still benefit a lot from disabling logging of struts
classes in jboss and caching the freemarker BeanWrapper.
Hope to see this in the PerformanceTuning wiki pages.
If I found WHAT's wrong with the previous version I'll make a note here.
Thanks to all who have tried to help.
Il giorno 25/giu/07, alle ore 18:40, Ing. Andrea Vettori ha scritto:
>>
>> I'll now try to profile the production server for a longer time
>> and keep you informed.
>>
>
> Unfortunately the garbage is still produced. But I can't profile
> the production server because the profiler crashes!
>
> Can anyone suggest a product to get the complete allocation object
> list ?
>
> Maybe in the meantime the yourkit guys resolve the problem but I
> really want to leave this problem behind as soon as possibile!
>
> Thank you
>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
>
> I'll now try to profile the production server for a longer time and
> keep you informed.
>
Unfortunately the garbage is still produced. But I can't profile the
production server because the profiler crashes!
Can anyone suggest a product to get the complete allocation object
list ?
Maybe in the meantime the yourkit guys resolve the problem but I
really want to leave this problem behind as soon as possibile!
Thank you
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Ok
I changed the jboss configuration. I think it would be helpful to put
an advice on the performance page of struts. If using jboss you
should limit the debug string production with
<category name="com.opensymphony">
<priority value="INFO"/>
</category>
<category name="ognl">
<priority value="INFO"/>
</category>
<category name="freemarker">
<priority value="INFO"/>
</category>
on log4j.xml
org.apache is already present in the default configuration.
I'll now try to profile the production server for a longer time and
keep you informed.
Thank you
Il giorno 25/giu/07, alle ore 12:06, Al Sutton ha scritto:
> The relevant piece of code is;
>
> if (LOG.isDebugEnabled()) {
> LOG.debug("Entering nullPropertyValue [target="+target+",
> property="+property+"]");
> }
>
> So the check is always present, but if the check is true (i.e.
> debug is on)
> it also has to build the log message from the components in the
> debug call
> (i.e. create "Entering nullPropertyValue [target=", then add the
> variable
> target, then add the string ", property=", then add the variable
> property,
> then add the character "]"), which is what the StringBuilder is doing.
>
> If the check is false, the call is not made, and the string doesn't
> need to
> be built, and hence no StringBuilder will be created, hence you'll
> see a
> drop of over 5% in your Gced object count for exactly the same test.
>
> -----Original Message-----
> From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
> Sent: 25 June 2007 10:36
> To: Al Sutton
> Subject: Re: [S2] App generate lot (2GB) of garbage!
>
> I'm using jboss...
>
> I'll try to find the configuration.
>
> Just curious :
> so in the source code the production of that strings are on a
> condition that
> check the log4j configuration ?
> This mean that the overhead of checking the condition is always
> present ?
>
> Il giorno 25/giu/07, alle ore 11:33, Al Sutton ha scritto:
>
>> Are you using log4j in your app or your appserver (e.g. Jetty uses
>> it)?
>>
>> If so look for a log4j.properties file which turns debug mode on with
>> a line similar to;
>>
>> log4j.rootLogger=DEBUG
>>
>> -----Original Message-----
>> From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
>> Sent: 25 June 2007 10:28
>> To: Struts Users Mailing List; Al Sutton
>> Subject: Re: [S2] App generate lot (2GB) of garbage!
>>
>>
>> Il giorno 25/giu/07, alle ore 11:21, Al Sutton ha scritto:
>>
>>> First thing I'd suggest; Turn off debug mode!!!!! It seems a
>>> chunk of
>>> the Gced objects are coming from preparing strings for log
>>> statements
>>> which are only activated when debug mode is on (for example;
>>> Com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyVa
>>> l
>>> u
>>> e(Map,
>>> Object, Object) accounts for 5% of Gced objects, of which nearly the
>>> entire 5% comes from StringBuilter and Log4JLoggerdebug which are
>>> only used when debug mode is on).
>>
>> How ??? devMode is already false in struts.xml
>>
>> I've noticed that's a lot of log4j calls but don't know if they
>> can be
>> removed!
>>
>> Thanks
>>
>>
>>>
>>> Secondly it does seem as though there's anything wildly wrong here,
>>> there aren't any single methods which have large Gced object counts
>>> indicating there isn't a big bottleneck (yes, some show 30+%, but
>>> that's fairly evenly divided between the methods called by the 30+%
>>> method), which leads me to one question, how much data are you
>>> trying
>>> to output? Can you do a "Save Source" and tell me the size of the
>>> HTML file generated?, can you also provide the call tree with a call
>>> count so we can see how many times the methods are being executed?
>>>
>>> Thanks,
>>>
>>> Al.
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
>>> Sent: 25 June 2007 09:35
>>> To: Struts Users Mailing List
>>> Subject: Re: [S2] App generate lot (2GB) of garbage!
>>>
>>>
>>> Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto:
>>>
>>>> Your trace is at too higher level. Can you put a fully expanded
>>>> copy
>>>> of your trace that goes down to the leaf methods.
>>>
>>> Done. It's on traceall.html. I expanded only the two most garbage
>>> producing top call.
>>>
>>> Thank you
>>>
>>> --
>>> Ing. Andrea Vettori
>>> Consulente per l'Information Technology
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> --
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>>
>>
>>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 25/giu/07, alle ore 11:21, Al Sutton ha scritto:
> First thing I'd suggest; Turn off debug mode!!!!! It seems a chunk
> of the
> Gced objects are coming from preparing strings for log statements
> which are
> only activated when debug mode is on (for example;
> Com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValu
> e(Map,
> Object, Object) accounts for 5% of Gced objects, of which nearly
> the entire
> 5% comes from StringBuilter and Log4JLoggerdebug which are only
> used when
> debug mode is on).
How ??? devMode is already false in struts.xml
I've noticed that's a lot of log4j calls but don't know if they can
be removed!
Thanks
>
> Secondly it does seem as though there's anything wildly wrong here,
> there
> aren't any single methods which have large Gced object counts
> indicating
> there isn't a big bottleneck (yes, some show 30+%, but that's
> fairly evenly
> divided between the methods called by the 30+% method), which leads
> me to
> one question, how much data are you trying to output? Can you do a
> "Save
> Source" and tell me the size of the HTML file generated?, can you also
> provide the call tree with a call count so we can see how many
> times the
> methods are being executed?
>
> Thanks,
>
> Al.
>
>
>
> -----Original Message-----
> From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
> Sent: 25 June 2007 09:35
> To: Struts Users Mailing List
> Subject: Re: [S2] App generate lot (2GB) of garbage!
>
>
> Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto:
>
>> Your trace is at too higher level. Can you put a fully expanded copy
>> of your trace that goes down to the leaf methods.
>
> Done. It's on traceall.html. I expanded only the two most garbage
> producing
> top call.
>
> Thank you
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: [S2] App generate lot (2GB) of garbage!
Posted by Al Sutton <al...@alsutton.com>.
First thing I'd suggest; Turn off debug mode!!!!! It seems a chunk of the
Gced objects are coming from preparing strings for log statements which are
only activated when debug mode is on (for example;
Com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(Map,
Object, Object) accounts for 5% of Gced objects, of which nearly the entire
5% comes from StringBuilter and Log4JLoggerdebug which are only used when
debug mode is on).
Secondly it does seem as though there's anything wildly wrong here, there
aren't any single methods which have large Gced object counts indicating
there isn't a big bottleneck (yes, some show 30+%, but that's fairly evenly
divided between the methods called by the 30+% method), which leads me to
one question, how much data are you trying to output? Can you do a "Save
Source" and tell me the size of the HTML file generated?, can you also
provide the call tree with a call count so we can see how many times the
methods are being executed?
Thanks,
Al.
-----Original Message-----
From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
Sent: 25 June 2007 09:35
To: Struts Users Mailing List
Subject: Re: [S2] App generate lot (2GB) of garbage!
Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto:
> Your trace is at too higher level. Can you put a fully expanded copy
> of your trace that goes down to the leaf methods.
Done. It's on traceall.html. I expanded only the two most garbage producing
top call.
Thank you
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 25/giu/07, alle ore 09:50, Al Sutton ha scritto:
> Your trace is at too higher level. Can you put a fully expanded
> copy of your
> trace that goes down to the leaf methods.
Done. It's on traceall.html. I expanded only the two most garbage
producing top call.
Thank you
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: [S2] App generate lot (2GB) of garbage!
Posted by Al Sutton <al...@alsutton.com>.
Your trace is at too higher level. Can you put a fully expanded copy of your
trace that goes down to the leaf methods.
At the moment your trace just shows that somewhere in the call stack under
some collection of conditions which are unknown to us the method and all
it's calls are generating lots of objects. What I'd like to see is the tree
expanded so I can see which methods are causing the gc'ed objects to be
created, because without your whole application running it's extremely
difficult to see the execution paths used to and thus determine which
methods are causing the problem. findValue in itself does not create
objects, so please post the fully expanded tree.
-----Original Message-----
From: Ing. Andrea Vettori [mailto:mail@andreavettori.com]
Sent: 25 June 2007 08:34
To: Struts Users Mailing List
Subject: Re: [S2] App generate lot (2GB) of garbage!
Hi,
I've run a profile with yourkit (nice!) on my development platform.
Here is the most important evidence. I've opened three product listings and
a couple of product sheet in my site. Total garbage collected : 234 MB.
Of these 234 MB, 64 are produced by
org.jboss.remoting.transport.socket.ServerThread.run() so they are related
to communication between the business layer and the presentation layer.
Most of the other (156MB) are produced by
com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's something
related to struts.
Going down the stack trace through interceptors the "last class" is
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation) that has 146MB of generated garbage.
Now the interesting part :
These 146MB are divided into :
34MB generated by freemarker.template.Template.process(Object, Writer) 22MB
generated by
com.opensymphony.xwork2.util.OgnlValueStack.findValue(String)
10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile
(ICompilationUnit[])
7MB generated by freemarker.template.Configuration.getTemplate(String)
6MB generated by org.eclipse.jdt.internal.compiler.Compiler.<init>
(INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor,
IProblemFactory, boolean)
and a few other with less then 3MB each.
You can find the complete trace on http://www.andreavettori.com/trace/
trace1.html.
Do they seems normal numbers ???
I also don't understand if the difference between 146 and about 90
(=34+22+10+7+6+other small) is produced by
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation). That's over 50MB!
Now if someone think that this can help solve my problem and understand
where is produced this garbage I can run the same profile on the production
server, maybe for a couple of minutes.
I'm also really interested into knowing if you guys have ever checked gc
collections on your applications... I don't think I'm the only one that
writes "garbage producer applications" :).
Thank you and please don't leave me alone with this problem!
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Hi,
I've run a profile with yourkit (nice!) on my development platform.
Here is the most important evidence. I've opened three product
listings and a couple of product sheet in my site. Total garbage
collected : 234 MB.
Of these 234 MB, 64 are produced by
org.jboss.remoting.transport.socket.ServerThread.run() so they are
related to communication between the business layer and the
presentation layer.
Most of the other (156MB) are produced by
com.opensymphony.xwork2.DefaultActionInvocation.invoke() so it's
something related to struts.
Going down the stack trace through interceptors the "last class" is
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation) that has 146MB of generated garbage.
Now the interesting part :
These 146MB are divided into :
34MB generated by freemarker.template.Template.process(Object, Writer)
22MB generated by
com.opensymphony.xwork2.util.OgnlValueStack.findValue(String)
10MB generated by org.eclipse.jdt.internal.compiler.Compiler.compile
(ICompilationUnit[])
7MB generated by freemarker.template.Configuration.getTemplate(String)
6MB generated by org.eclipse.jdt.internal.compiler.Compiler.<init>
(INameEnvironment, IErrorHandlingPolicy, Map, ICompilerRequestor,
IProblemFactory, boolean)
and a few other with less then 3MB each.
You can find the complete trace on http://www.andreavettori.com/trace/
trace1.html.
Do they seems normal numbers ???
I also don't understand if the difference between 146 and about 90
(=34+22+10+7+6+other small) is produced by
org.apache.struts2.dispatcher.StrutsResultSupport.execute
(ActionInvocation). That's over 50MB!
Now if someone think that this can help solve my problem and
understand where is produced this garbage I can run the same profile
on the production server, maybe for a couple of minutes.
I'm also really interested into knowing if you guys have ever checked
gc collections on your applications... I don't think I'm the only one
that writes "garbage producer applications" :).
Thank you and please don't leave me alone with this problem!
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 23/giu/07, alle ore 09:19, Musachy Barroso ha scritto:
> Struts 2 uses freemarker to generate the html for the tags, for
> example for
> the form tag this template is used:
>
> http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/
> resources/template/simple/form.ftl?view=markup
So struts asks freemarker to generate the html for the struts tag.
Freemarker looks at the template and outputs the html based on it.
Freemarker is caching the template in memory to not have to read them
from the disk every time. Looks similar to what jsp compiler do with
the difference that jsp tags have "hard-coded" html and freemarker
has template based html. Am I right ?
But what's the various BeanWrappers doing in the previous process ?
It's about the passing of "parameters" from the struts tag to
FreeMarker ?
It's the BeanWrappers that was consuming a lot of memory before I
enabled caching of them.
>
> I was playing with jrockit also and trying to replicate the
> problem, but it
> is kind of hard :). Do you have any testcase, or a page, something
> that
> could help us replicate the problem?
The jrcmd command that's used to profiling is not working on my
server :( I posted a question on the bea forum.... This problem is a
hell !!! :)
I don't think I can produce a testcase but I try to tell how is the
application organized (btw you can view the site on
www.elettrotop.com but don't think this can help to solve the
problem...).
I have a MaxDB (formerly SAPDB) database that's accessed ONLY through
EJB3 session beans / entity beans. I'm using JBoss 4.0.5-GA which
uses Hibernate 3.
The view is composed of struts2 actions, a few servlets producing
PDFs and images and jsp pages.
All the view logic is inside struts2 actions and they access the
database using RMI call to stateless and stateful session beans. Now
it's all inside the same server but this architecture gives me the
option to separate the web interface (with the option to have more
than one web server) from the business logic (maybe on another
server) and the database (maybe on another server).
I've implemented a lot of caching of (mostly read-only) database data
in the struts actions but the profiler says that less than 100MB are
used by my classes. Also the cache lasts at least a Session life so
it can't be part of the 2GB that's collected since this happens every
10 seconds or less (using sun jvm). I've checked I don't have
_unfortunately_ a lot sessions that dies every 10 seconds :)
Most used page of the site is the product listings where the user can
browse an "in ram" list of dataobjects created with an ejb3 query in
a session bean. The entire list is returned and cached for struts2
action as said above.
When I first profiled the app, the most ram demanding classes was
freemarker.ext.beans..... generated HashMaps (between 400 and 500 mb).
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Musachy Barroso <mu...@gmail.com>.
Struts 2 uses freemarker to generate the html for the tags, for example for
the form tag this template is used:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/form.ftl?view=markup
I was playing with jrockit also and trying to replicate the problem, but it
is kind of hard :). Do you have any testcase, or a page, something that
could help us replicate the problem? I also posted a note on the freemarker
list on how struts configures freemarker, which is on this class:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java?view=markup
On that same package there is an StrutsBeanWrapper which is the wrapper used
with freemarker. (I think you asked about it right? memory failing...it is
kind of late :) )
regards
musachy
On 6/23/07, Ing. Andrea Vettori <ma...@andreavettori.com> wrote:
>
>
> Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto:
>
> > Yes, freemarker is used by Struts 2 tags to generate html. We could
> > have a
> > property for the cache setting, but, does it solve your problem?
> > (you said
> > it was partially resolved)
>
>
> Most of the garbage is still there but at least about 400-500 MB
> generated from freemarker classes seems not there anymore.
> I tried to use jrockit instead of sun jvm since it has a better
> memory analyzer but I haven't been able to produce a report yet.
>
>
> May I ask more on how struts2 is using freemarker ?
> How is freemarker used in a code snippet like this :
>
> <td width="34%" valign="bottom" class="fontNormale"
> align="center">
> <span>
> <s:form name="RicercaArticoliVisOrdina"
> action="RicercaArticoliVis">
> Ordina per <s:select list="%
> {listaOrdinamentoArticoli}" value="${numeri.ordinamento[0]}"
> name="ordinamento" onchange="document.RicercaArticoliVisOrdina.submit
> ()"/>
> <s:hidden name="idRicerca" value="$
> {numeri.idRicerca}"/>
> </s:form>
> </span>
> </td>
> <td width="33%" valign="bottom" class="fontNormale"
> align="right">
> <span>
> <s:form name="RicercaArticoliVisDimPagina"
> action="RicercaArticoliVis">
> Mostra <s:select list="{5, 10, 20, 30}"
> value="${numeri.dimPagina}" name="dimPagina"
> onchange="document.RicercaArticoliVisDimPagina.submit()"/> prodotti
> per pagina
> <s:hidden name="idRicerca" value="$
> {numeri.idRicerca}"/>
> </s:form>
> </span>
> </td>
>
> What object are created ?
>
> Thanks
>
>
>
>
>
>
>
>
>
>
> >
> > regards
> > musachy
> >
> > On 6/20/07, Ing. Andrea Vettori <ma...@andreavettori.com> wrote:
> >>
> >> I discussed the problem with the freemarker team and I used a
> >> suggestion that PARTIALLY resolved.
> >>
> >> They said :
> >>
> >> =====
> >>
> >> You can use the code below to enable the model cache, assuming
> >> "myConfiguration" is the reference to your Configuration object:
> >>
> >> ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)
> >>
> >> and see if it helps you with your GC load levels.
> >>
> >> =====
> >>
> >> This actually seems to happen.
> >> In struts how can this be done ? I used :
> >>
> >>
> >> freemarker.template.Configuration fmc =
> >> (freemarker.template.Configuration)
> >> ServletActionContext.getServletContext().getAttribute
> >> (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
> >> if (fmc != null) {
> >> ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
> >> ()).setUseCache(true);
> >> }
> >>
> >>
> >> but I think there must be a configuration somewhere
> >> (struts.properties?).
> >>
> >>
> >> To completely solve my problem I really need to understand the
> >> following :
> >>
> >> How struts uses freemarker ? If i have a jsp page that contains html,
> >> jsp tags, struts tags and jsp EL expression, where freemarker is
> >> used ?
> >> I suppose that it's used ONLY on struts tags...
> >>
> >> So if my page is composed primarly of jsp EL and jsp tags and a few
> >> struts tags can I focus on struts tags only to try to understand why
> >> the app is producing garbage ?
> >>
> >>
> >> Thank you
> >>
> >>
> >>
> >> Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:
> >>
> >> >
> >> > Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
> >> >
> >> >> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
> >> >>>
> >> >>> Moreover I'm not using freemaker in my project! It's struts
> >> that's
> >> >>> using it.
> >> >>> My page are all jsps !!
> >> >>
> >> >>
> >> >>
> >> >> This is pretty strange... Is FreeMarker servlet declared in your
> >> >> web.xml?
> >> >
> >> > No it's not.
> >> >
> >> > I think that freemarker classes are used by struts internally for
> >> > the themes... I use the simple theme.
> >> >
> >> > I really can't understand what's producing near 2GB of garbage
> >> > every 10 seconds!
> >> >
> >> >
> >> > --
> >> > Ing. Andrea Vettori
> >> > Consulente per l'Information Technology
> >> >
> >> >
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: user-help@struts.apache.org
> >> >
> >>
> >> --
> >> Ing. Andrea Vettori
> >> Consulente per l'Information Technology
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 22/giu/07, alle ore 19:20, Musachy Barroso ha scritto:
> Yes, freemarker is used by Struts 2 tags to generate html. We could
> have a
> property for the cache setting, but, does it solve your problem?
> (you said
> it was partially resolved)
Most of the garbage is still there but at least about 400-500 MB
generated from freemarker classes seems not there anymore.
I tried to use jrockit instead of sun jvm since it has a better
memory analyzer but I haven't been able to produce a report yet.
May I ask more on how struts2 is using freemarker ?
How is freemarker used in a code snippet like this :
<td width="34%" valign="bottom" class="fontNormale"
align="center">
<span>
<s:form name="RicercaArticoliVisOrdina"
action="RicercaArticoliVis">
Ordina per <s:select list="%
{listaOrdinamentoArticoli}" value="${numeri.ordinamento[0]}"
name="ordinamento" onchange="document.RicercaArticoliVisOrdina.submit
()"/>
<s:hidden name="idRicerca" value="$
{numeri.idRicerca}"/>
</s:form>
</span>
</td>
<td width="33%" valign="bottom" class="fontNormale"
align="right">
<span>
<s:form name="RicercaArticoliVisDimPagina"
action="RicercaArticoliVis">
Mostra <s:select list="{5, 10, 20, 30}"
value="${numeri.dimPagina}" name="dimPagina"
onchange="document.RicercaArticoliVisDimPagina.submit()"/> prodotti
per pagina
<s:hidden name="idRicerca" value="$
{numeri.idRicerca}"/>
</s:form>
</span>
</td>
What object are created ?
Thanks
>
> regards
> musachy
>
> On 6/20/07, Ing. Andrea Vettori <ma...@andreavettori.com> wrote:
>>
>> I discussed the problem with the freemarker team and I used a
>> suggestion that PARTIALLY resolved.
>>
>> They said :
>>
>> =====
>>
>> You can use the code below to enable the model cache, assuming
>> "myConfiguration" is the reference to your Configuration object:
>>
>> ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)
>>
>> and see if it helps you with your GC load levels.
>>
>> =====
>>
>> This actually seems to happen.
>> In struts how can this be done ? I used :
>>
>>
>> freemarker.template.Configuration fmc =
>> (freemarker.template.Configuration)
>> ServletActionContext.getServletContext().getAttribute
>> (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
>> if (fmc != null) {
>> ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
>> ()).setUseCache(true);
>> }
>>
>>
>> but I think there must be a configuration somewhere
>> (struts.properties?).
>>
>>
>> To completely solve my problem I really need to understand the
>> following :
>>
>> How struts uses freemarker ? If i have a jsp page that contains html,
>> jsp tags, struts tags and jsp EL expression, where freemarker is
>> used ?
>> I suppose that it's used ONLY on struts tags...
>>
>> So if my page is composed primarly of jsp EL and jsp tags and a few
>> struts tags can I focus on struts tags only to try to understand why
>> the app is producing garbage ?
>>
>>
>> Thank you
>>
>>
>>
>> Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:
>>
>> >
>> > Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
>> >
>> >> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>> >>>
>> >>> Moreover I'm not using freemaker in my project! It's struts
>> that's
>> >>> using it.
>> >>> My page are all jsps !!
>> >>
>> >>
>> >>
>> >> This is pretty strange... Is FreeMarker servlet declared in your
>> >> web.xml?
>> >
>> > No it's not.
>> >
>> > I think that freemarker classes are used by struts internally for
>> > the themes... I use the simple theme.
>> >
>> > I really can't understand what's producing near 2GB of garbage
>> > every 10 seconds!
>> >
>> >
>> > --
>> > Ing. Andrea Vettori
>> > Consulente per l'Information Technology
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>>
>> --
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Musachy Barroso <mu...@gmail.com>.
Yes, freemarker is used by Struts 2 tags to generate html. We could have a
property for the cache setting, but, does it solve your problem? (you said
it was partially resolved)
regards
musachy
On 6/20/07, Ing. Andrea Vettori <ma...@andreavettori.com> wrote:
>
> I discussed the problem with the freemarker team and I used a
> suggestion that PARTIALLY resolved.
>
> They said :
>
> =====
>
> You can use the code below to enable the model cache, assuming
> "myConfiguration" is the reference to your Configuration object:
>
> ((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)
>
> and see if it helps you with your GC load levels.
>
> =====
>
> This actually seems to happen.
> In struts how can this be done ? I used :
>
>
> freemarker.template.Configuration fmc =
> (freemarker.template.Configuration)
> ServletActionContext.getServletContext().getAttribute
> (FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
> if (fmc != null) {
> ((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
> ()).setUseCache(true);
> }
>
>
> but I think there must be a configuration somewhere
> (struts.properties?).
>
>
> To completely solve my problem I really need to understand the
> following :
>
> How struts uses freemarker ? If i have a jsp page that contains html,
> jsp tags, struts tags and jsp EL expression, where freemarker is used ?
> I suppose that it's used ONLY on struts tags...
>
> So if my page is composed primarly of jsp EL and jsp tags and a few
> struts tags can I focus on struts tags only to try to understand why
> the app is producing garbage ?
>
>
> Thank you
>
>
>
> Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:
>
> >
> > Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
> >
> >> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
> >>>
> >>> Moreover I'm not using freemaker in my project! It's struts that's
> >>> using it.
> >>> My page are all jsps !!
> >>
> >>
> >>
> >> This is pretty strange... Is FreeMarker servlet declared in your
> >> web.xml?
> >
> > No it's not.
> >
> > I think that freemarker classes are used by struts internally for
> > the themes... I use the simple theme.
> >
> > I really can't understand what's producing near 2GB of garbage
> > every 10 seconds!
> >
> >
> > --
> > Ing. Andrea Vettori
> > Consulente per l'Information Technology
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
There are three pages of issues on freemarker... I'll take a look at
them and see if it's already present.
Thank you
Il giorno 22/giu/07, alle ore 19:17, Antonio Petrelli ha scritto:
> Andrea,
> please create a JIRA issue for this, and join the discussion at the
> Struts Developers list too, if possible:
> http://www.nabble.com/-S2--FreeMarker-usage-in-Struts-2-tf3965756.html
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Antonio Petrelli <an...@gmail.com>.
Andrea,
please create a JIRA issue for this, and join the discussion at the
Struts Developers list too, if possible:
http://www.nabble.com/-S2--FreeMarker-usage-in-Struts-2-tf3965756.html
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
I discussed the problem with the freemarker team and I used a
suggestion that PARTIALLY resolved.
They said :
=====
You can use the code below to enable the model cache, assuming
"myConfiguration" is the reference to your Configuration object:
((BeansWrapper)myConfiguration.getObjectWrapper()).setUseCache(true)
and see if it helps you with your GC load levels.
=====
This actually seems to happen.
In struts how can this be done ? I used :
freemarker.template.Configuration fmc =
(freemarker.template.Configuration)
ServletActionContext.getServletContext().getAttribute
(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY);
if (fmc != null) {
((freemarker.ext.beans.BeansWrapper)fmc.getObjectWrapper
()).setUseCache(true);
}
but I think there must be a configuration somewhere
(struts.properties?).
To completely solve my problem I really need to understand the
following :
How struts uses freemarker ? If i have a jsp page that contains html,
jsp tags, struts tags and jsp EL expression, where freemarker is used ?
I suppose that it's used ONLY on struts tags...
So if my page is composed primarly of jsp EL and jsp tags and a few
struts tags can I focus on struts tags only to try to understand why
the app is producing garbage ?
Thank you
Il giorno 19/giu/07, alle ore 12:58, Ing. Andrea Vettori ha scritto:
>
> Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
>
>> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>>>
>>> Moreover I'm not using freemaker in my project! It's struts that's
>>> using it.
>>> My page are all jsps !!
>>
>>
>>
>> This is pretty strange... Is FreeMarker servlet declared in your
>> web.xml?
>
> No it's not.
>
> I think that freemarker classes are used by struts internally for
> the themes... I use the simple theme.
>
> I really can't understand what's producing near 2GB of garbage
> every 10 seconds!
>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Il giorno 19/giu/07, alle ore 12:07, Antonio Petrelli ha scritto:
> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>>
>> Moreover I'm not using freemaker in my project! It's struts that's
>> using it.
>> My page are all jsps !!
>
>
>
> This is pretty strange... Is FreeMarker servlet declared in your
> web.xml?
No it's not.
I think that freemarker classes are used by struts internally for the
themes... I use the simple theme.
I really can't understand what's producing near 2GB of garbage every
10 seconds!
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>
> Moreover I'm not using freemaker in my project! It's struts that's
> using it.
> My page are all jsps !!
This is pretty strange... Is FreeMarker servlet declared in your web.xml?
Antonio
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Moreover I'm not using freemaker in my project! It's struts that's
using it.
My page are all jsps !!
Il giorno 19/giu/07, alle ore 11:41, Ing. Andrea Vettori ha scritto:
> yes but their list and forum seems almost dead...
>
> I hope someone in the struts team can help me found what's the
> problem...
>
>
> Il giorno 19/giu/07, alle ore 11:39, Antonio Petrelli ha scritto:
>
>> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>>>
>>> Anyone knows who's calling freemarker.ext.beans methods ?
>>
>>
>>
>> Did you try asking the FreeMarker team?
>>
>> Antonio
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
yes but their list and forum seems almost dead...
I hope someone in the struts team can help me found what's the
problem...
Il giorno 19/giu/07, alle ore 11:39, Antonio Petrelli ha scritto:
> 2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>>
>> Anyone knows who's calling freemarker.ext.beans methods ?
>
>
>
> Did you try asking the FreeMarker team?
>
> Antonio
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/19, Ing. Andrea Vettori <ma...@andreavettori.com>:
>
> Anyone knows who's calling freemarker.ext.beans methods ?
Did you try asking the FreeMarker team?
Antonio
Re: [S2] App generate lot (2GB) of garbage!
Posted by Oguz Kologlu <oz...@optusnet.com.au>.
You may want to have a look at using a bit better profiler that can
tell you what is instantiating the freemarker classes.
I've noticed Code Gear (ex Borland) have released a free version of
JBuilder with OptimizeIt built in:
Have a look at http://www.codegear.com/eclipse_supercharged/index.html
Let us know if you get any results
HTH
Oz
http://www.codegear.com/eclipse_supercharged/index.html
On 20/06/2007, at 4:00 AM, Matt Filion wrote:
> Without knowing much more about your application I dont know if we are
> going to be of much more help. Especially since most people here
> already
> have struts 2 apps running and dont have this issue. I have a
> couple of
> resources that might help you though while you dig through this issue.
>
> You can see some of the source on the objects referanced in your
> memory
> trace. Seeing the source of other objects is some times helpful.
> http://www.koders.com/?s=freemarker.ext.util.ModelFactory&la=Java
>
> It looks like you already have this one cause you mention addressing a
> couple of the items. The last one mentions using velocity tags over
> struts
> tags not sure if this would be your issue, but might be worth
> looking at.
> http://struts.apache.org/2.x/docs/performance-tuning.html
>
> Matt Filion
> CSC - GTS --> Raytheon - ISF
> mfilion@csc.com
>
>
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ------------------------------------
> This is a PRIVATE message. If you are not the intended recipient,
> please
> delete without copying and kindly advise us by e-mail of the
> mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not
> operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the
> use of
> e-mail for such purpose.
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ------------------------------------
>
>
>
>
> "Ing. Andrea Vettori" <ma...@andreavettori.com>
> 06/19/2007 02:19 AM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
>
>
> To
> "Struts Users Mailing List" <us...@struts.apache.org>
> cc
>
> Subject
> Re: [S2] App generate lot (2GB) of garbage!
>
>
>
>
>
>
> Anyone ?
>
> Anyone knows who's calling freemarker.ext.beans methods ?
>
>
> Il giorno 17/giu/07, alle ore 19:08, Ing. Andrea Vettori ha scritto:
>
>> Hi,
>> I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an
>> e-commerce site.
>>
>> I have the following problem.
>> The app seems to generate lot of garbage in RAM (young gen) that
>> the gc correctly collects.
>> But when there is more than a few users on the site, that amount of
>> garbage is generated about every 10 seconds or less depending on
>> the number of users. This cause a lot of cpu usage...
>>
>> Tracking the memory usage with the hprof agent I found that a lot
>> of memory is used by freemarker.* classes on HashMaps.
>>
>> I have devMode turned off, have the "template" dir on the root of
>> the war file and I have the freemarker.properties file into the
>> classes dir inside WEB-INF with template_update_delay=60000.
>>
>> Any hint on WHY the application is generating such big amount of
>> garbage ?
>>
>> Thank you
>>
>> Here is top memory usage and relative traces :
>>
>>
>> bytes 192,090,608
>> obj number: 1,263,754
>> class: java.util.HashMap$Entry[]
>>
>> TRACE 352396:
>> java.util.HashMap.<init>(HashMap.java:203)
>> freemarker.ext.beans.BeanModel.<init>
>> (BeanModel.java:117)
>> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
>> freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
>>
>>
>> bytes: 143,560,048
>> obj number: 944,474
>> class: java.util.HashMap$Entry[]
>>
>> TRACE 352387:
>> java.util.HashMap.<init>(HashMap.java:203)
>> freemarker.ext.beans.BeanModel.<init>
>> (BeanModel.java:117)
>> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
>> freemarker.ext.beans.MapModel.<init>(MapModel.java:
>> 105)
>>
>>
>> bytes: 141,327,104
>> obj number: 2,208,236
>> class: java.util.HashMap
>>
>> TRACE 352386:
>> java.util.AbstractMap.<init>(AbstractMap.java:53)
>> java.util.HashMap.<init>(HashMap.java:200)
>> freemarker.ext.beans.BeanModel.<init>
>> (BeanModel.java:117)
>> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
>>
>>
>>
>> --
>> Ing. Andrea Vettori
>> Consulente per l'Information Technology
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by Matt Filion <mf...@csc.com>.
Without knowing much more about your application I dont know if we are
going to be of much more help. Especially since most people here already
have struts 2 apps running and dont have this issue. I have a couple of
resources that might help you though while you dig through this issue.
You can see some of the source on the objects referanced in your memory
trace. Seeing the source of other objects is some times helpful.
http://www.koders.com/?s=freemarker.ext.util.ModelFactory&la=Java
It looks like you already have this one cause you mention addressing a
couple of the items. The last one mentions using velocity tags over struts
tags not sure if this would be your issue, but might be worth looking at.
http://struts.apache.org/2.x/docs/performance-tuning.html
Matt Filion
CSC - GTS --> Raytheon - ISF
mfilion@csc.com
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit
written agreement or government initiative expressly permitting the use of
e-mail for such purpose.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Ing. Andrea Vettori" <ma...@andreavettori.com>
06/19/2007 02:19 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
"Struts Users Mailing List" <us...@struts.apache.org>
cc
Subject
Re: [S2] App generate lot (2GB) of garbage!
Anyone ?
Anyone knows who's calling freemarker.ext.beans methods ?
Il giorno 17/giu/07, alle ore 19:08, Ing. Andrea Vettori ha scritto:
> Hi,
> I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an
> e-commerce site.
>
> I have the following problem.
> The app seems to generate lot of garbage in RAM (young gen) that
> the gc correctly collects.
> But when there is more than a few users on the site, that amount of
> garbage is generated about every 10 seconds or less depending on
> the number of users. This cause a lot of cpu usage...
>
> Tracking the memory usage with the hprof agent I found that a lot
> of memory is used by freemarker.* classes on HashMaps.
>
> I have devMode turned off, have the "template" dir on the root of
> the war file and I have the freemarker.properties file into the
> classes dir inside WEB-INF with template_update_delay=60000.
>
> Any hint on WHY the application is generating such big amount of
> garbage ?
>
> Thank you
>
> Here is top memory usage and relative traces :
>
>
> bytes 192,090,608
> obj number: 1,263,754
> class: java.util.HashMap$Entry[]
>
> TRACE 352396:
> java.util.HashMap.<init>(HashMap.java:203)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
> freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
>
>
> bytes: 143,560,048
> obj number: 944,474
> class: java.util.HashMap$Entry[]
>
> TRACE 352387:
> java.util.HashMap.<init>(HashMap.java:203)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
> freemarker.ext.beans.MapModel.<init>(MapModel.java:105)
>
>
> bytes: 141,327,104
> obj number: 2,208,236
> class: java.util.HashMap
>
> TRACE 352386:
> java.util.AbstractMap.<init>(AbstractMap.java:53)
> java.util.HashMap.<init>(HashMap.java:200)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
>
>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] App generate lot (2GB) of garbage!
Posted by "Ing. Andrea Vettori" <ma...@andreavettori.com>.
Anyone ?
Anyone knows who's calling freemarker.ext.beans methods ?
Il giorno 17/giu/07, alle ore 19:08, Ing. Andrea Vettori ha scritto:
> Hi,
> I've a struts 2.0.8 app that runs on Linux and JBoss 4.0.5. I'ts an
> e-commerce site.
>
> I have the following problem.
> The app seems to generate lot of garbage in RAM (young gen) that
> the gc correctly collects.
> But when there is more than a few users on the site, that amount of
> garbage is generated about every 10 seconds or less depending on
> the number of users. This cause a lot of cpu usage...
>
> Tracking the memory usage with the hprof agent I found that a lot
> of memory is used by freemarker.* classes on HashMaps.
>
> I have devMode turned off, have the "template" dir on the root of
> the war file and I have the freemarker.properties file into the
> classes dir inside WEB-INF with template_update_delay=60000.
>
> Any hint on WHY the application is generating such big amount of
> garbage ?
>
> Thank you
>
> Here is top memory usage and relative traces :
>
>
> bytes 192,090,608
> obj number: 1,263,754
> class: java.util.HashMap$Entry[]
>
> TRACE 352396:
> java.util.HashMap.<init>(HashMap.java:203)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
> freemarker.ext.beans.StringModel$1.create(StringModel.java:75)
>
>
> bytes: 143,560,048
> obj number: 944,474
> class: java.util.HashMap$Entry[]
>
> TRACE 352387:
> java.util.HashMap.<init>(HashMap.java:203)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
> freemarker.ext.beans.MapModel.<init>(MapModel.java:105)
>
>
> bytes: 141,327,104
> obj number: 2,208,236
> class: java.util.HashMap
>
> TRACE 352386:
> java.util.AbstractMap.<init>(AbstractMap.java:53)
> java.util.HashMap.<init>(HashMap.java:200)
> freemarker.ext.beans.BeanModel.<init>(BeanModel.java:117)
> freemarker.ext.beans.StringModel.<init>(StringModel.java:90)
>
>
>
> --
> Ing. Andrea Vettori
> Consulente per l'Information Technology
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
Ing. Andrea Vettori
Consulente per l'Information Technology
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org