The Oracle Web Cache is a powerful tool that can be used to
significantly reduce the load on both the application server and the
backend database. Oracle testing showed that placing Web
Cache in front of the application server can reduce the back-end
database load by 85%. However, it is important to configure
Web Cache and you application/database properly.
When properly used, the Web Cache will server both static and dynamic
objects to meet user request. Request for objects that are not in the
cache or are invalid or stale, are passed back to the application
server. The more effective the web cache, the greater the load
reduction on the application server.
Most users do not properly configure the web cache, significantly
reducing it's effectiveness.
The Rule of the Web Cache are:
1. Cache Everything You Can.
2. Use Expire Carefully
3. Invalidate Only What Is Invalid.
It looks simple but it takes some planning.
1. Cache Everything You Can: It pay to cache whatever you can,
even documents that are dynamically created for an individual user.
If the user refreshes the browser, the web cache will server the page
rather than the application server (and database) recreating it.
This has to also be balanced with the size of the cache. Like the
Library Cache in the Oracle database, too large can have a negative
effect on cache performance. The larger the cache, the more
objects in the cache and the longer it takes to search the cache.
However, since Web Cache stored documents as URLs, it can efficiently
search a large cache.
2. Use Expire Carefully: Expire is a timestamp that tells
all the caches a served document passes through when that document
becomes stale. After the timestamp, the object/document must be
recreated if requested. This is great for documents that change on
a regular schedule (a weather report that is updated every hour) but is
not as effective for objects that change on an irregular bases. A
better solution may be to let the browser cache the document. When
the browser needs a document, it looks in its cache and if it is present
send a Last-Modified timestamp with the document request. Web
Cache will check the cache and if it contains the document and it has
not been modified since the Last_Modified timestamp of the request Web
Cache will return a Not-Modified code telling the browser to server the
document from its local cache. The method creates some additional
network traffic but results in only re-serving a document when it
3. Invalidate Only What Is Invalid: This is the problem I
see the most. Again Web Cache stores documents in URLs (that is
how the request come in). Many times I have seen PL/SQL triggers
that invalidate the DocumentRoot for the site/application. This
means that every time the trigger files, in invalidates virtually the
entire cache. Again the solution is planning. Design the
application/site to use multiple URLs, placing related objects together.
Then build your PL/SQL triggers (or application invalidation messages)
to only invalidate objects that have actually become invalid due to the
change. For example, a change to the EMP table could fire a
trigger that invalidates all objects (static or dynamic) that have been
built with data from that table. If the trigger invalidates the
DocumentRoot, everything is invalidated, even objects that have nothing
to do with the EMP table. Try to place the documents related to
the EMP table in a URL that does not include objects that are not
related to EMP. Insure that your trigger invalidates only those
objects based on the underlying data. This takes planning and
sometimes is not feasible. The key is to try an invalidate only
what become invalid.
Web Cache out-of-the-box is a great tool, but with some planning you
can really put its capabilities to work!
Want to get rid of that extra database, learn how to install your
Metadata Repository into a backend database using the Oracle REPCA
utility. It's easy!
App Server Support?
I'm now offering personal app server mentoring for Oracle DBAs who
must quickly learn the intricate details of Oracle9iAS. You can
have an Oracle expert right at your fingertips, anytime day or night.
We work with dozens of App Server Oracle databases every year, so we
know exactly how to quickly assist you with any Oracle9iAS or Oracle
Application Server 10g question.
Burleson Oracle Consulting
Kittrell, NC, USA, 27544