Optimizing servlet performance, Loading servlet classes, Automatic class reloading – Oracle Audio Technologies A86828-01 User Manual

Page 57: Auto

background image

Optimizing Servlet Performance

Optimizing Apache JServ


Optimizing Servlet Performance

This section discusses strategies for optimizing JServ performance: loading servlets
when starting the JVM, and load balancing.

The terms “repository” and “zone” are used in this discussion. Servlets,
repositories, and zones are analogous to files, directories and virtual hosts. A servlet
is a single unit, a repository is a collection of servlets, and a zone is a collection of

Loading Servlet Classes

Apache JServ allows you to load servlet classes when the JVM is started. To do this,
put the servlets to load in the


directive in the servlet zone

properties file. When the servlet is loaded, its


method is called. All other

servlets (those not listed in


) are loaded and initialized on first


Using this facility increases the start-up time for your JServ process, but improves
first-request latency for servlets.

Pre-Loading with JSPs

If you are using a JSP as the servlet (your code does not extend


), you

will be unable to use this pre-load option, but you could pre-load the JSP runner by
including the





If the first-request latency for your initialization routines is really a performance
issue, you can achieve some of the results described above by creating a dummy
servlet to call your one-time initialization routines in its


method. You must

add the name of the dummy servlet to



Automatic Class Reloading



is set to true for a zone (the default), then each time one

of that zone’s servlets is requested, every class that has been loaded from a
repository in that zone is checked to see if it has been modified. If one of the classes
has changed, then all previously loaded classes from the zone’s repositories are
unloaded, which means that as the classes are needed, they will be loaded from
their class files again.

This is a useful development feature, because you can install new versions or drop
in new class files without restarting the server. For optimal performance in
production environments, however, you should set both automatic class reloading