velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bruno <brunoca...@yahoo.com>
Subject how to reduce memory usage and still use the cache?
Date Thu, 03 Aug 2006 13:07:41 GMT
Hello,
We are using velocity for our web application, it is working pretty fine 
but now we have a problem because it consumes too much memory.

When I run the application with the property
webapp.resource.loader.cache=true
after running a sample of 20 request of different pages, the memory used 
is about 300 Mb . (after garbage collector calls)

After running the same sample with
webapp.resource.loader.cache=false ,
the memory consumption is only about 30Mb!

We need to use the cache because of speed (the pages are processed more 
than ten times faster!) but on the other hand, we also would like to run 
several instances of the application on the same computer, so the memory 
usage is now a limitation for us.

I tried using the file resouce loader and I get the same results.

I have the impression that the velocity performs a kind of compilation 
of the templates, that are then interpreted and optionally cached in memory.
Is it possible to cache this ‘compiled’ templates on disk instead of memory?

We are using jdk1.5.0_07 and velocity 1.4. I get the same results on 
Windows and Linux.

Any suggestions?
Thanks in advance
Bruno

Here is our velocity.properties:


# velocity.properties
#--------------------



velocimacro.library = \
WEB-INF/velocimacros/Global.vm,\
WEB-INF/velocimacros/Debug.vm,\
WEB-INF/velocimacros/Menu.vm,\
WEB-INF/velocimacros/Layout.vm,\
WEB-INF/velocimacros/Buttons.vm,\
WEB-INF/velocimacros/Fields.vm,\
WEB-INF/velocimacros/List.vm,\
WEB-INF/velocimacros/CRUD.vm,\
WEB-INF/velocimacros/Filters.vm,\
WEB-INF/velocimacros/Report.vm,\
WEB-INF/velocimacros/Misc.vm,\
WEB-INF/velocimacros/Ams.vm


runtime.log.logsystem.class = 
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.log4j.category = Velocity



# Default name of the loop counter variable reference.
directive.foreach.counter.name = velocityCount
# Default starting value of the loop counter variable reference.
directive.foreach.counter.initial.value = 0

resource.loader = webapp
webapp.resource.loader.class = 
org.apache.velocity.tools.view.servlet.WebappLoader


## -- PRODUCTION setup 
---------------------------------------------------------------------------------- 


velocimacro.library.autoreload=false
webapp.resource.loader.cache=true


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message