Determining Memory Requirements
Sizing and Configuration 3-5
To maximize performance, set the maximum heap size to accommodate application
requirements. To determine how much Java heap you need, include calls in your
program to the Runtime.getRuntime().totalMemory() and
Runtime.getRuntime().freeMemory methods in the java.lang package.
Subtract free memory from total memory; the difference is the amount of heap that
the application consumed.
Suppose you determine that you need 128MB of heap. To change the heap size, you
would set the maximum Java heap size in the jserv.properties file for automatic
mode:
wrapper.bin.parameters=-mx128m
In manual mode, if more than one JServ process is running, the heap size must be
set on the command line for each JServ process.
When a JServ process exceeds its maximum heap size, the process terminates. In
automatic mode, a new process is started, but performance is degraded
significantly. In manual mode, a terminated process will not be restarted, so ensure
that the heap size is sufficient.
Servlet and OracleJSP pages Memory RequirementsOracleJSP pages (Oracle’s implementation of Sun’s JavaServer Pages) and servlets
require different amounts of memory, depending on the version of the JDK used.
The chart below compares memory requirements for a simple servlet and an Oracle
JSP page under load with 10-30 active threads. The servlet did not use sessions. The
OracleJSP page had sessions on (the default).
Note: The process size reported by utilities such as top or ps will
be larger than the maximum heap size, because private memory is
added to the maximum heap size.
Table 3–3 Servlet and OracleJSP pages memory
Component JDK 1.1.8 JDK 1.2
Servlet 10MB 24MB
OracleJSP page 10MB 32MB