Oracle Audio Technologies A86828-01 Server User Manual


 
Optimizing Servlet Performance
Optimizing Apache JServ 5-7
b.
If the request is not part of a session, mod_jserv selects an engine based on
the process ID of the httpd process and the number of entries in the list of
available JServs, as follows:
JServ_id to handle the request = httpd_pid % number of JServs in the list
This method distributes requests across the available JServ engines fairly
evenly.
Using Single Thread Model Servlets
Oracle recommends that you write your servlets to implement the
SingleThreadModel (STM) interface. An application that was modified to
implement the STM interface demonstrated a 25% improvement in response time,
probably due to a decrease in synchronization bottlenecks.
It is also much easier to manage database connections with STM servlets. The
database connection can be set up in the init() method of the servlet, and closed
in the destroy() method. When executing the servlet’s doGet() or service()
method, you need not be concerned with obtaining a database connection.
Alternatively, you can use JDBC connection caching.
There are three parameters in the zone.properties file that impact the performance
of STM servlets in particular. These govern:
The minimum number of servlet object instances that will be generated and
available after the servlet class is loaded
The maximum number that can be generated
The number that should be generated if the available instances are insufficient
Because it is very costly to generate instances while the system is running, Oracle
recommends that you set your minimum to equal your maximum value. The
optimum value depends somewhat on how many connections your database server
can handle. This should be split among the JServ processes, as follows:
See Chapter 3, "Sizing and Configuration" for suggestions on determining the right
number of JServ processes for your application, and "Load Balancing" on page 5-4
for the steps to configure them. Suppose you’ve determined that you want 10
servlet instances per process. Then, in the properties file for your zone, set:
Total DB connections / Number of JServ processes = Number of STM servlet
instances per process