velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <>
Subject Re: performance questions - faster Introspector
Date Mon, 10 Sep 2001 11:48:18 GMT
"Geir Magnusson Jr." wrote:
> On 9/9/01 11:30 PM, "Bojan Smojver" <> wrote:
> > "Geir Magnusson Jr." wrote:
> >>
> >> Two points on this :
> >>
> >> 1) If you have a big installation, and you share one instance of Velocity
> >> across all of your webapps via Tomcat's lib, you are asking for trouble, I
> >> think.  I can't see much benefit to that other than desire to avoid multiple
> >> copies of the jar.  If that is the case, and you want to keep your webapps
> >> partitioned, then use the separate instance runtime (which I think you are
> >> doing, Bojan).  If *that* is the case, then I think you are safe, as nothing
> >> is a singleton in the separate instance, your servlet holds the reference to
> >> it, and when your servlet is recycled on the classloader change, then you
> >> let go of the refrerence to the vel runtime, and get a new one.  All is
> >> well.
> >
> > You know what they say - people do things because they're lazy. So do I.
> > With number of virtual hosts/apps growing, I have to make sure everyone
> > gets the updated Velocity jar. And being a lazy bastard I am... One
> > solution is to symlink the thing, works well. Ant (my site build tool)
> > doesn't like those much though when it copies files around, so I had to
> > use platform specific hacks and that's ugly. I used to have multiple
> > copies of Velocity around before, I just wanted to clean up the mess.
> I think you misunderstood me

Could be. Sorry about that.

> - I think that it is a valid reason to have one
> on top to avoid duplication. (You may have troubles when one app wants a new
> version, but I guess you can drop into the webapp itself then.)

> I tend to keep them separate, as I don't have a large number, and I want the
> ability for each webapp to have different versions.

Since I really started using Velocity from version 1.0, not much has
changed (which can only be good) in the way templates work. I only have
one servlet, so when I move forward, I move forward in all apps (except
for the legacy JSP stuff).

> But since you are using separate runtimes for each servlet... (read below..)
> > Not to worry, I can go either way, I just wanted to use Velocity as one
> > of the 'standard' Tomcat app libraries, without the need to do anything
> > special within each app.
> Since you are using the separate runtime instance model in your servlet
> (VelocityEngine), then I think there is no problem if you keep it in
> tomcat/lib because each servlet has it's own instance of the engine.

Cool :-)

> Before the fixes I committed earlier today, even the separate instance
> runtime would have problems with the introspector collecting junk, as the
> Introspector was left as a singleton (my fault... It's fixed now).
> Now, by using the separate instance in your servlet, when your CL gets
> dumped, the servlet gets dumped, so the VelocityEngine will eventually get
> GC'd, and since the Introspector is no longer a Singleton, it will get GC'd
> as well.
> Unless I am missing something (quite possibly, as I am on vacation and
> rather muddy headed...), all should be well for you.
> We still should add the change, I think. (I am merging the current state,
> Attila's patch, and Paulo's improvement...)

I've seen the comitted patch and it uses private class variables, so I
guess it will there will be 1 to 1 relationship between VelocityEngine,
RuntimeInstance and Introspector, which means there will ba quite a few
Introspectors around once all those VelocityEngines kick in. I'll
download and give it a try.


View raw message