
Chapter 5 Web Application Tuning
Using the servlet Java cache
The servlet Java cache stores servlet output in Java core
memory, which offers a faster response than page caching for servlets
that can run under these limitations:
- The output
does not change during the cache timeout period, and does not depend
on request method, parameters, or headers.
- The servlet runs with exact path mappings. Responses
are not cached if the servlet uses prefix mappings, default mappings,
or extension mappings.
- Cached content is returned without modification.
- Cached response headers are returned without modification,
except for:
- Return code 200 is used for all cached replies.
If the original response uses any other return code, it is not cached.
- Chunked replies are not cached.
- Only responses to GET requests are cached.
Servlets that cannot run under these limitations may still
use the page cache.
To
enable and configure the servlet Java cache, configure the following
servlet properties for each servlet to be cached, using the Advanced
tab in the Servlet Properties window:
- com.sybase.jaguar.servlet.javacache.enabled enables
the Java cache for the servlet. A value of true enables the Java
cache. The default value of false disables the cache. If the Java
cache and the page cache are both enabled, the Java cache takes
precedence.
- com.sybase.jaguar.servlet.javacache.session specifies
how session cookie settings are treated by checking Set-Cookie headers
in the request and response headers. Allowable values for this property
are:
| Value
|
To indicate
|
no
(the
default)
|
No session support. EAServer does not
check request Set-Cookie headers or return response Set-Cookie headers.
|
keep
|
Attempt to preserve valid sessions. If the
request includes a session identifier, EAServer checks if the session
is valid. If it is not, the response Set-Cookie header is set to indicate
an invalid session. Otherwise, no Set-Cookie header is returned.
|
create
|
Preserve valid session and create a new
session if the previous session is invalid. If the request includes
a session identifier, EAServer checks if the session is valid. If
it is not, the response Set-Cookie header is set to indicate a new
session. Otherwise, no Set-Cookie header is returned.
|
- com.sybase.jaguar.servlet.javacache.maxsize specifies
the size, in kilobytes, of the largest reply that can be cached.
Responses larger than this are not cached. The default is 8. The
hard upper limit is 100. If you set a value greater than 100, the
effective cache size is 100K.
- com.sybase.jaguar.servlet.javacache.timeout specifies
the time, in seconds, that cached responses remain valid. The default
is 60. A negative value specifies an infinite timeout, that is,
cached responses do not expire.
|
Copyright (C) 2004. Sybase Inc. All rights reserved.
|
|