velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: performance questions
Date Thu, 06 Sep 2001 22:03:47 GMT
On 9/6/01 5:26 PM, "Will Glass-Husain" <> wrote:

> Hi,
> I'm seeing my servlet memory usage climb over time (with a fairly small user
> base), and wondering if Velocity could be playing a role.  I'm using a
> subclass of VelocityServlet, (velocity version 1.2-dev) on Apache Tomcat
> 3.2.3.
> (1) Every time I upload a new JAR file with my servlet, my memory usage goes
> up significantly.  Could there be some type of memory "leak" with either the
> template cache or introspection?  (I've read the note in the Developer's
> Guide on this and have turned caching on).

I am not sure what happens with Tomcat's classloader when you load a new
jar.  I would think that if it's just your servlet, then the Velocity stuff
wouldn't need to change.  The template cache will hold what it has.  The
introspector might accumulate gunk over time, but I wouldn't think that
would be significant amounts of memory.  I assume that the JAR only contains

> One hypothesis I have is that the Velocity singleton may be accumulating
> unnecessary info when the Tomcat classloader reloads my JAR file.  Any ideas
> on this?
> (2) Going to new pages increases the memory usage.  Does the template cache
> ever clear?

No - that is something we want to put in for the case where you have a large
content site (say thousands of articles that are #include()-ed into the
page)  For normal use, it shouldn't matter because  it stores by resource
name, so if you reload the same page, the new AST will replace the old one.
> A note on my configuration.  I have no file "".  Instead,
> I call the following code in the "loadConfiguration" method of my servlet.
> (appended to the end of this message).  Not sure if this affects the memory
> issue.
> Appreciate any ideas.
> Thanks, WILL
> ******
> final public Properties loadConfiguration(ServletConfig cfg) {
> Properties p;
> p = new Properties();
> p.setProperty("file.resource.loader.path",
> getInitParameter("TemplatePath"));
> p.setProperty("fileresource.loader.cache","true");
> p.setProperty("velocimacro.library","macro_library.fml");
> p.setProperty("velocimacro.permissions.allow.inline.local.scope","true");
> p.setProperty("runtime.log.invalid.references ","false");
> p.setProperty("resource.manager.logwhenfound","false");
> p.setProperty("runtime.log.logsystem.class",
> "com.forio.servlet.ForioLogger");
> return p;
> }

Everything looks fine here.  Do you need local scope for VMs?  That would
add to memory usage, but unless you went VM-crazy, it shouldn't be of major


View raw message