velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: performance questions - faster Introspector
Date Mon, 10 Sep 2001 09:42:22 GMT
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 - 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.

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.

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...)


>> 2) I still think we are adding unnecessary complexityh re the
>> per-classloader dumping.  KISS.
> No worries.
> Bojan

Geir Magnusson Jr.
System and Software Consulting
Developing for the web?  See
If you look up, there are no limits - Japanese Proverb

View raw message