Running a background process in multiple threads is almost always
faster than running it in a single thread. The trick is determining
the number of threads that is optimal for each process.
Note: A good rule of thumb is to have one thread for every 100 MHz
of application server CPU available. For example if you have four
450 MHz processors available on your application server, you can start
with 18 threads to begin your testing: (450 * 4) / 100 = 18.
This is a rule of thumb because each process is different and is
dependent on the data in your database. Also, your hardware configuration
(i.e., number of processors, speed of your disk drives, speed of the
network between the database server and the application server) has
an impact on the optimal number of threads. Please follow these guidelines
to determine the optimal number of threads for each background process:
- Execute the background process using the number of threads dictated
by the rule of thumb (described above). During this execution, monitor
the utilization percentage of your application server, database server
and network traffic.
- If you find that your database server has hit 100% utilization,
but your application server hasn't one of the following is probably
occurring:
- There may be a problematic SQL statement executing during the
process. You must capture a database trace to identify the problem
SQL.
- It is also possible that your commit frequency may be too large.
Commit frequency is a parameter supplied to every background process.
If it is too large, the database's hold queues can start swapping.
Refer to Parameters Supplied to Background Processes for more information
about this parameter.
- It is normal if you find that your application server
has hit 100% utilization but your database server has not. This is
normal because, in general, all processes are CPU bound and not IO
bound. At this point, you should decrease the number of threads until
just under 100% of the application server utilization is achieved.
And this will be the optimal number of threads required for this background
process.
- If you find that your application server has NOT hit 100% utilization,
you should increase the number of threads until you achieve just under
100% utilization on the application server. And remember, the application
server should achieve 100% utilization before the database server
reaches 100% utilization. If this proves not to be true, something
is probably wrong with an SQL statement and you must capture an SQL
trace to determine the culprit.
Another way to achieve similar results is to start out with a small
number of threads and increase the number of threads until you have
maximized throughput. The definition of "throughput" may differ for
each process but can be generalized as a simple count of the records
processed in the batch run tree. For example, in the Billing background
process in Oracle Utilities Customer Care and Billing, throughput
is the number of bills processed per minute. If you opt to use this
method, we recommend you graph a curve of throughput vs. number of
threads. The graph should display a curve that is steep at first but
then flattens as more threads are added. Eventually adding more threads
will cause the throughput to decline. Through this type of analysis
you can determine the optimum number of threads to execute for any
given process.
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.