 |
|
Monitoring and Load Balancing the Oracle HTTP
Server (OHS)
Oracle Application Server Tips by Burleson
Consulting |
The HTTP Server is an important part of the
Oracle9iAS architecture because a delay at this level will delay
initial connection to your Oracle9iAS system and also cause delays
in the generation and dispatch of outgoing HTML and XML documents.
As we noted in Chapter 1, connection to OHS
required several round-trips while establishing connectivity (Figure
10.6).
Figure 10.6: OHS entry procedure
Because OHS is used at least twice during
every web transaction, we must be able to identify the components of
OHS processing and find a way to track each component process.
Next, let?s examine the common tools used to monitor the OHS server
and report on performance metrics.
Monitoring Oracle9iAS with Dynamic
Monitoring Service (dmstool)
The Dynamic Monitoring service dmstool
utility is a command line program that is used to display elapsed
time performance metrics. The dmstool utility can be used to
view metrics on several Oracle9iAS components:
-
OC4J ? dmstool can measure the time
required to parse incoming requests and the total free RAM in the
JVM.
-
Oracle9iAS Portal ? Important
Portal metrics can be easily displayed.
-
Servlet code ? You can add dms
metrics of any Java code to capture additional statistics.
-
Oracle HTTP Server (OHS) ? dmstool
can measure the current active requests in the HTTP server.
Before we explore the command syntax for
dmstool we need to note that you can use your browser to quickly
look at detailed dms statistics.
Browser-based statistics viewing
You can see the raw dmstool statistics by
reviewing the httpd.conf file and finding the URL for the dms dump
file. Invoking the dms URL will display the raw dms data in
your browser (Figure 10.7). Here we issue the
http://appsvr.localdomain.com:7778/dms0 URL and see the dms data:
Figure 10.7: Displaying the dms raw data
with your browser
You can also use URL-based queries to locate
server performance data (Figure 10.8). Here we invoke the
http://appsvr.localdomain.com:7778/server-status URL and see details
on the Apache server status:
Figure 10.8: Displaying the dms raw data
with your browser
Extending dms for Java code
As we have noted, you can capture you own
dms diagnostics. Let?s look at how you can add dms metrics to
a servlet. In the example below we see that the prints ?This
is a test? (Listing 10.5).
import
java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public
class Test extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse
response )
throws ServletException, IOException
{
response.getWriter().println("This is a Test. " );
}
}
Listing 10.5: Java servlet without dms
Now we can take this code and add a dms
metric by importing the oracle dms instrument library and adding a
display message each time the servlet is executed (Listing 10.6):
import
java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.dms.instrument.*;
public
class TestA extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse
response )
throws ServletException, IOException
{
Event beginAccess =
Event.create("/ oracle / TestA / dms ",
" TestA Write Succeded");
res.getWriter().println(" This is a test of Test. ");
begin Access.occurred();
}
}
Listing 10.6: Servlet with dms
instrumentation
Now that we have reviewed the basics we are
ready to take a close look at issuing native dmstool commands to
extract Oracle9iAS performance data.
Using dmstool commands
When using the dmstool list option (-l), you
will generate a list of over 300 monitoring metrics for Oracle9iAS.
In the example below, we constrain the dmstool output to only those
lines that contain the ?completed? string:
#!/bin/ksh
PATH=$PATH:/home/oracle/oraportal904/bin
export PATH
dmstool -l
|grep completed
The output of this script (Listing 10.7)
will show us all of the available metrics containing the word
?completed?. We will use this list as input to a more detailed
dmstool command in the next step.
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/default/WEBs/parseRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/default/WEBs/processRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/default/WEBs/resolveContext.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/portal/WEBs/parseRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/portal/WEBs/processRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/portal/WEBs/resolveContext.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/syndserver/WEBs/parseRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/syndserver/WEBs/processRequest.completed
/appsvr.lcldm.com/OC4J:3303:6004/oc4j/syndserver/WEBs/resolveContext.completed
Listing 10.7: Sample dmstool listing
for completed requests
Note: the Oracle9iAS parameters are
generally specified in ?Camel? notation. This is the
convention where the words are concatenated together, and all words
after the first are Capitalized, creating the ?humps? which
characterize Camel notation.
We can use this listing of completed
operations to get counts of the total operations over a specific
period of time. Let?s use this list as input parameters for
more advanced dmstool commands.
Summarizing dmstool data by time
intervals
Using the dmstool with the interval option
(-i) and the collection option (-c). The dmstool command
specifies the collection of 100 sets of data at 60-second intervals.
#!/bin/ksh
PATH=$PATH:/home/oracle/oraportal904/bin
export PATH
dmstool -i
60 -c 100 \
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
\
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
\
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
\
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
> t1.lst
Here is the output from this script. Here we see the
cumulative number of operations, displayed every minute, for each
handle, request and completion operation (Listing 10.8):
Sun
Jul 13 20:19:43 MDT 2003
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
240320 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
146504 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/connection.completed
56908 ops
Sun Jul 13
20:20:43 MDT 2003
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
240474 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
146598 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/connection.completed
56948 ops
Sun Jul 13 20:21:43 MDT 2003
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
240668 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
146732 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/connection.completed
56978 ops
Sun
Jul 13 20:22:43 MDT 2003
/appsvr.localdomain.com/Apache:2534:6004/Apache/handle.completed
240825 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/request.completed
146829 ops
/appsvr.localdomain.com/Apache:2534:6004/Apache/connection.completed
57028 ops
Listing 10.8: Display cumulative operations
By itself, this output does not show the
marginal changes between time periods, but you can either write a
program or paste the output into an MS-Excel spreadsheet and use the
chart wizard to plot the changes (Figure 10.9). Here is a
sample of the time-based changes to the three OHS server operations
counts:
Figure 10.9: Plotting dmstool output with
MS-Excel
This is an excerpt from "Oracle
10g Application Server Administration Handbook" by Don Burleson
and John Garmany.