[opencms-dev] Performance Tuning Questions
Christian Steinert
christian_steinert at web.de
Sun Jul 19 12:03:14 CEST 2009
> So question 2, if I set a secondary Flex Caching for the XML files
> that provide the data to those pages, would that result in a
> significant reduction in database queries.
>
I don't know if the flex cache works for that. AFAIK, the flex cache
will cache processed results rather than files in the virtual file system.
What you can do and what will make a big difference is to
- move the JSP code that creates re-usable page parts into individual files
- set proper caching for each of these JSP snippets. The caching policy
can be different for different files
- include those JSP splinters into your regular templates.
In this way, your templates will only re-process those parts of your
page that really need to be re-created, which can make a big difference.
Of course you should only cache those result snippets that really are
re-used across several pages.
I don't know about any way in standard opencms to cache the raw,
unprocessed file system data so that files are not always re-read from
the DB when they are accessed. If I am not mistaken, this can be
accomplished through Alkacon's commercial OCEE Accellerator module. I
could well imagine that - of course also dependent on how your
application works - this module might provide big improvements.
Of course, you could try to roll your own cache for the file access that
you are doing, but first you should profile your DB access. I had cached
some FS access in my template layer and it made zero difference (I
already had cached all result snippets that are used more than once
though, which made a huge difference). When I profiled opencms a bit
more thoroughly, I noticed that most read access was triggered directly
by the page request handling of opencms and that the direct data access
of my own templates was only a minor part. After that, I just removed
any template-side caching again (our template-based read access was
either badly cachable or mostly eliminated by flex-cached recurring page
snippets). Now we just run with flex-cached result snippets and the
mysql query cache, both of which together give very significant
performance improvements.
If, however you read the same XML files again and again and you still
cannot cache the result page snippets and you have profiled that these
read operations are a bottleneck for you, then you could create your own
cache for this kind of data. Of course, as with any cache, getting it to
really perform well and to invalidate old/outdated content properly will
take some thinking, a good library and some work.
I did not profile Mysql directly, I just profiled the Java code of
opencms, which implicitly also profiles the DB access times. Sun's
VisualVM is quite good for that (Java 1.6 required).
Also, you may want to give recent versions of Java 1.6 a try. Sun is
really doing a lot to improve performance. The latest Java update (6u14)
for example has experimental features for escape analysis and on 64bit
VMs for compressed pointers, both of which seem to yield dramatic
improvements in some scenarios. I have not tried these features with
opencms, but I very well may in the near future.
Hth
Christian
More information about the opencms-dev
mailing list