Although there are quite some new screenbased application techniques, a lot of companies use the traditional Oracle Forms & Reports.
Even with the transition to an entire new application server, WebLogic, Oracle has ported their traditional applications like Forms to the 11g stack.
In this article I will guide you to some performance improving techniques I gained from my year to year experience working with Middleware products
The Oracle HTTP Server
Oracle HTTP listener receives the request.
It forwards the request to MOD_OC4J that handles all servlet requests. MOD_OC4J decides if it is intended for Forms since the path “/forms/frmservlet”
matches one of the OC4J mount directives in the forms90.conf or forms.conffile (the one for the Forms Servlet).
MOD_OC4J maps the request to the Oracle Forms application (whose context root is /forms90 or /forms) in the OC4J servlet engine.
MOD_OC4J passes the request to the Forms Servlet (using the f90servlet or frmservlet servlet mapping specified in the web.xml file).
The Forms Servlet (running in OC4J) processes the request as follows: It opens the servlet configuration file (formsweb.cfg by default)
and starts to donwload the file to the client machine.
If the paramter envfile is not set, the default configuration file (/forms90/server/formsweb.cfg) or (/forms/server/formsweb.cfg)is used.
HTTP Tuning
These parameters in the httpd.conf are relevant for tuning:
- KeepAlive
- MaxClient
- MinSpareServers
- MaxSpareServers
- KeepAliveTimeout
- MaxRequestsPerChild
- ThreadLimit
- ThreadsPerChild
- Global-thread-pool
There are some possibilities for tuning which are listed in more detail in the
following:
1. Limit the number of processes (HTTPD on Unix; THREAD on NT) to avoid spawning too many HTTPD processes (which is memory consuming). Don’t set the LD_ASSUME_KERNEL option!
2. Set the following directive in the Oracle HTTP Listener configuration file httpd.conf:
KeepAlive Off
If you must use KeepAlive On (for example, for another application), make sure that KeepAliveTimeout is set to a low number (for example, 15 seconds,
which is the default). It keeps the current TCP/IP connection open for awhile after the HTTP transaction ends, allowing that same connection to be used for several subsequent HTTP transactions. So it reduces latency, and speeds up both the client and server connections. But for forms every new connection is a new transaction.
3. Set the maxClient directive to a high value.
The best is to let the HTTP Listener control to create more HTTPD daemons.
Therefore set the maxClient directive to a high value in the configuration file (httpd.conf).
However, you need to consider the memory available on the system when setting this parameter. You can let the HTTP Listener determine when to create more HTTPD daemons. Therefore, set the MaxClients directive to a high value in the configuration file (httpd.conf). However, you need to consider the memory available on the system when setting this parameter.MaxClients=256 means that the listener can create up to 256 HTTPD processes to handle concurrent requests.
4. MinSpareServers / MaxSpareServers
If your HTTP requests come in bursts, and you want to reduce the time to start the necessary HTTPD processes,
you can set MinSpareServers and MaxSpareServers within httpd.conf) to have an appropriate number of processes ready.
However, the default values of 5 and 10 respectively are sufficient for most sites.
5. The MaxRequestsPerChild directive sets the limit on the number of requests
that an individual child server process will handle. After MaxRequestsPerChild requests, the child process will die.
If MaxRequestsPerChild is 0, then the process will never expire. This directive sets the maximum configured value for ThreadsPerChild for the
lifetime of the Apache process. Any attempts to change this directive during a restart will be ignored, but ThreadsPerChild can be modified during a
restart up to the value of this directive.
6. ThreadsPerChild
This directive sets the number of threads created by each child process. The child creates these threads at startup and never creates more.
OC4J tuning Section
You can specify the use of a thread pool for an OC4J process through the global-thread-pool element in the server.xml file.
If you do not specify the use of a thread pool, OC4J will create the number of threads that is necessary required to service your application
workload in an unbounded fashion.
You can configure OC4J to create a single thread pool containing all threads. The other way is that two thread pools are created containing different types
of threads, through the element in the server.xml file.
If you do not specify this element, then an unbounded number of new threads are created as needed for the OC4J process.
Example
=======
debug="true" /> ...
Recommendations:
The queue attributes should be at least twice the size of the maximum number of threads.The minimum and maximum number of worker threads should be a multiple of the number of CPUs installed on your machine and fairly small. The more threads you have, the more burden you put on the operating system and the garbage collector. The minimum that you should set is 10.
When running benchmarks or in a production environment, once you figure out the right number of threads, set the minimum to the maximum number, and the
keepAlive attribute to negative one (-1).
Take care when you modify these parameters. It helps in many cases when increasing them. But if the values are too high estimated then the system
starts dramatically to swap and takes most of the time to handle the swapping process. And degrade the system uses memory and CPU time!
To create a single pool, configure the min, max, queue, and keepAlive attributes. To create two pools, configure the min, max, queue, and keepAlive attributes for the first pool and the cx-min, cx-max, cx-queue, and cx-keepAlive attributes for the second pool.
In order to activate two thread pools, you must configure all the attributes for the first thread pool, which includes min, max, queue, and keepAlive. If any of these attributes is not configured, you cannot configure the second pool.
OC4J Java options
- Xms(sizem) -Xmx(sizem)
- Xss
- client
- server
- session-timeout
-Xms(sizem) -Xmx(sizem)
If you know that your application will consistently require a larger amount of heap, you can improve performance by setting the minimum heap size equal to
the maximum heap size, by setting the JVM -Xms size = -Xmx size.
Some other usefull settings:
-Xt turn on instruction tracing
-Xtm turn on method tracing
-Xbootclasspath[/a|/p]:
set, append to, or prepend to boot class path
-Xdebug enable remote debugging
-Xnoclassgc disable class garbage collection
-Xss set maximum native stack size for any thread
-Xoss set maximum Java stack size for any thread
-Xms set initial Java heap size
-Xmx set maximum Java heap size
-Xrs reduce the use of OS signals
-Xrunhprof[:help]|[:
Perform heap or cpu profiling –>
-Xmaxjitcodesize; set the maximum size (in bytes) for the JIT code area
-Xsqnopause do not pause for user interaction on sigquit
-Xoptimize Experimental: Use optimizing JIT compiler (SPARC only)
Possible Errors:
Exception java.lang.OutOfMemoryError: requested bytes
If you see this symptom, consider increasing the available swap space by allocating more of your disk for virtual memory and/or by
limiting the number of applications you run simultaneously.You may also be able to avoid this problem by setting the command-line
flags -Xmx and -Xms to the same value. This prevents the VM from trying to expand the heap. Note that simply increasing the value of -Xmx will not help when no swap space is available.
-client and -server
Assuming that you are running a lot of bytecodes. Make sure that you are usingthe correct mode of the virtual machine.
For applications that need small footprint and fast startup, use -client.
For applications where overall performance is the most important issue, use -server.
Don’t forget that -server or -client must be the FIRST argument to java (default is -client).
Do not use the -server option when running OC4J on Oracle Application Server for Windows systems.
-Xss
It depends on the particular J2EE application to change the setting of the command line option -Xss for the JVM running OC4J and with that – maybe – to improve performance.
The default C code stack size is 512kb(-Xss512k).
A value of 64kb is the smallest amount of C code stack space allowed per thread. Oracle recommends that you try the following value to improve the performance
of your J2EE applications:
Example
-Xss128k
session-timeout
Set session-timeout parameter to the same or higher value as the Forms90_Timeout or Forms_Timeout parameter. You can set the session-timeout parameter in the
web.xml file that configures the Forms Servlet. The default timeout in Oracle AS is 20 minutes.
To set the session time-out to 15 minutes do the following:
web.xml file is present in the following directory:
OracleAS –> j2EE –> OC4J_BI_Forms –> applications –> forms90app or formsapp –>forms90web or formsweb –> Web-inf
MaxBlockTime
MaxBlockTime is the time in milli seconds to wait when reading data from the Runform process.
e.g. a long query, lots of complex processing
(default = 1000 milli sec)
/j2EE/OC4J_BI_Forms/application/forms90app/forms90web/WEB-INF/web.xml
or
/j2EE/OC4J_BI_Forms/application/formsapp/formsweb/WEB-INF/web.xml
Example
or
Explained
For long requests (like querying a big table), the ListenerServlet waits for a default time of 1 second for the Forms runtime process to complete the request If the request is not completed then the Listener Servlet sends a busy response to the client asking the client to retry.
The client sends a retry zero content length request to check if the query is complete.This default time of 1 second can be configured using Listener Servlet
parameter called maxBlockTime
OC4J Load Balancing for Forms
The easiest way to do this is to increase the number of oc4j processes.
Choose Oracle Enterprise Manager (OEM) Website
–> Select the Midtier instance
–> OC4J_BI_FORMS
–> Server properties.
Choose Multiple VM Configuration and there increase the “Number of process”.
Check for Island ID (default = 1).
Save the changes.
This can also be seen in the opmn.xml file under the opmn directory of the Midtier.
But take care if you have defined 2 OC4J instances and you have set the Parameter -Xms=512M. The instance then allocates 1,1 GB Memory( 2* 515MB).
If you set this parameter (Xmx and Xms) you have to be sure that you have enough physical memory. Otherwise you will get an error message when you try to start the instance.
If run into OC4j timeouts you can continue to change following options that can in the mod_oc4j.conf file:
Oc4jConnTimeout 30
Oc4jCacheSize 0
Oc4jUseKeepalive on
If you want to loadbalance, and there are two hosts in an Oracle Application Server cluster: Host_A and Host_B. Each has Oracle HTTP Server and OC4J processes running on them, then add the following to the mod_oc4j.conf:
Oc4jSelectMethod random:local
Oc4jRoutingWeight Host_A 3
Oc4jRoutingWeight Host_B 2
Oc4jRoutingWeight directives are ignored. mod_oc4j on Host_A randomly routes all requests to OC4J processes on Host_A, mod_oc4j on Host_B randomly routes all requests to OC4J processes on Host_B. mod_oc4j on all the machines route requests equally to OC4J processes on Host_A, Host_B, in a round robin manner.
Forms Server Side Tuning
- FORMS90_TIMEOUT / FORMS_TIMEOUT
- heartbeat
- networkRetries
Forms Runtime Pooling enables the startup of a configurable number of application runtime engines prior to their usage. Runtime Pooling provides
quick connections at server peak times, which shortens the server-side application startup time. Runtime pooling is useful for situations where server configurations have a small window in which many users connect to a Forms application. All prestarted runtime engines run in the same environment serving the same application.
Example formsweb.cfg
[appn_b]
form=login_appn_b.fmx
prestartRuntimes=true
prestartInit=5
prestartMin=4
prestartIncrement=3
prestartTimeout=5
FORMSxx_TIMEOUT
This parameter specifies the amount of time (in minutes) before the Forms Server process is terminated when there is no client communication with the Forms Server. The internal default value is 15, and valid values are integers between 3 – 1440 minutes.
Often it happens that the client does not provide any action and Forms starts to terminate the communication between the client and the Forms runtime engine process
This raises errors like FRM-92050, FRM-92100, FRM-92101
Heartbeat
This parameter sets the frequency at which a client sends a packet to the server to indicate that it is
still running (default = 2 min).
Set this parameter value greater than the value specified for the FORMSnn_TIMEOUT variable.
For example set it to 7 minutes as follows after the serverArgs parameter:
For Internet Explorer: