----- Original Message -----
From: "Lukasz Skowronski" <ls26990(a)sgh.waw.pl>
To: "XWiki Developers" <devs(a)xwiki.org>
Sent: Thursday, November 19, 2009 4:54 PM
Subject: [xwiki-devs] Velocity parsed template caching
Did you think about using StringResourceLoader (or something similar)
instead of Velocity.evaluate()? I believe caching parsed ASTs rather than
reparsing the same strings everytime could significantly improve overall
performance.
I'm sending a patch that uses StringResourceLoader.
It may need a little tweaking [1] but generally seems to work.
I made the following test:
1. Start XWiki server with monitoring enabled
2. Go to /xwiki/bin/view/Blog/ ten times
3. Go to /xwiki/bin/view/XWiki/RequestsStatus
.. and the results are ...
========
Original XWiki:
========
* Duration: 42780 ms
* Requests: 21
* Average: 2037 ms
* multipart duration: 10 ms Calls: 21 Requests: 21 Average: 0 ms
* rendering duration: 10744 ms Calls: 563 Requests: 21 Average: 511 ms
* hibernate duration: 5506 ms Calls: 374 Requests: 11 Average: 500 ms
* prenotify duration: 0 ms Calls: 21 Requests: 21 Average: 0 ms
* request duration: 42760 ms Calls: 21 Requests: 21 Average: 2036 ms
* notify duration: 10 ms Calls: 21 Requests: 21 Average: 0 ms
========
With patch:
========
* Duration: 34543 ms
* Requests: 21
* Average: 1644 ms
* multipart duration: 0 ms Calls: 21 Requests: 21 Average: 0 ms
* rendering duration: 10133 ms Calls: 563 Requests: 21 Average: 482 ms
* hibernate duration: 5651 ms Calls: 374 Requests: 11 Average: 513 ms
* prenotify duration: 0 ms Calls: 21 Requests: 21 Average: 0 ms
* request duration: 34493 ms Calls: 21 Requests: 21 Average: 1642 ms
* notify duration: 30 ms Calls: 21 Requests: 21 Average: 1 ms
BTW what does request duration include apart from hibernate and rendering?
Now I'm going to experiment with webapp loader cache.
Kind regards
Lukasz
[1] I changed velocimacro.permissions.allow.inline.local.scope to false in
order to properly run the blog app (the original one, I didn't upgraded it
to 2.0 syntax yet).
It might be necessary to somehow use the hack with rsvc.parse(source,
templateName, false); but actually I'm not sure about it... At the moment I
don't understand the difference between setting
velocimacro.permissions.allow.inline.local.scope=false and using Da Hack...
;)
It might be also good idea to set resource.manager.defaultcache.size=<some
number>