There are some common guidelines to follow that can improve
application performance and reduce system load.
The following are some guidelines to follow:
- Do tune your application resources to optimize for caching. Do
not accept web/application server defaults.
- Do set Expires, Last-Modified, or your servlets or JSP content.
- Do not assume that Expires=0 means no-cache. No-cache means
don’t cache. Expires=0 means that content is stale
immediately (can be used by max-stale).
- Do specify an appropriate Expires header for cacheable content.
- Do specify an appropriate cache type for resources {public, private, no-cache, no-store}.
- Do specify no-cache for pure dynamic content
(content that is always different).
- Do marry expiration to content generation (for example, DB only
updates every 3 days, so the expiration should be set to 3 days to
avoid redundant retrieval of content. If the expiration is set to
1 day, for example, we would have 2 redundant queries for each necessary
one.).
- Don’t use content-location with inline grammars.
- Do make transient grammars small.
- Do make large grammars public (persistent, shareable).
- Do favor external grammars instead of inline.
- Do preload grammars that match the pre-load criteria and set the
grammar cache size appropriately.
- Do set the expiration to a millennium date for large grammars,
using max-age to control refreshing.
Grammar Scenarios and tuning recommendations
- I use only precompiled grammars in my applications that never
expire.
- If the precompiled grammars are large they should be preload and
streamed. If any case, cache conservation should be used and the grammar
cache size should be set to the number of bytes used by the grammars
plus a small amount (100k) for cache overhead. To refresh the cache
with newer precompiled grammars, stop WebSphere® Voice Server and restart,
it will automatically re-fetch fresher content.
- I use precompiled grammars in my applications that sometimes expire.
- Precompiled grammars that expire during WebSphere Voice Server uptime should
not be preloaded. Large precompiled grammars should be streamed.
If any case, cache conservation should be used and the grammar cache
size should be set to the number of bytes used by the grammars plus
a small amount (100k) for cache overhead.
- I use one large source grammar, with various public entry points
for all my applications.
- If the grammar never expires, preload the various public entry
points. In any case, the source is only fetched once and only the
public entry points and their rule dependencies are compiled into
binary grammars. Do not enable cache conservation.
- I use a mixture of source and precompiled grammars.
- Preload those precompiled grammars that never expire and enable
streaming by setting stream configuration to the size of the smallest
precompiled.