Oracle9i Application Server Oracle HTTP Server powered by Apache Performance Guide
Release 1.0.2.2 for Sun SPARC Solaris

Part Number A86676-02

Library

Contents

Index

Go to previous page Go to next page

2
Monitoring Your Web Server

This chapterdescribes utilities and processes you can use to gather performance information from your system. This information helps you to determine the best use of your resources.

This chapter contains the following sections:

Monitoring Processor Use

In order to solve performance problems or tune your system, it is useful to know how the CPU is spending its time (for example, scheduling tasks or performing work). You can determine process utilization by gathering CPU statistics, or evaluate system scalability by adding users and increasing the system workload, then monitoring paging, swapping, and CPU utilization. Use utilities such as sar (System Activity Reporter) and mpstat to monitor process use.

Using the sar Utility

You can use sar to sample cumulative activity counters in the operating system at specified intervals.

Report CPU Utilization

To determine process use, use the sar command. In the example below, the command options -u, 3 and 10 tell sar to report CPU utilization in three second intervals ten times.

prompt>sar -u 3 10

SunOS jpond-sun 5.6 Generic_105181-19 sun4u    10/12/00

12:17:04    %usr    %sys    %wio   %idle
12:17:07       1       0       0      99
12:17:10       0       2       0      97
12:17:13       3       0       0      96
12:17:16      20       6       1      72
12:17:19      15      14       0      71
12:17:22       6       5       0      89
12:17:25       1       0       0      99
12:17:28      16      13       6      65
12:17:31       1       2       1      96
12:17:34       0       1       0      99

Average        6       4       1      88

The statistics above show that the CPU was 88% idle for the given time interval. If your performance criteria specify that CPU usage must be below a certain percentage, then you can use sar to sample usage at a chosen interval during peak load times.

The sar command (-u option) provides the following statistics:

Table 2-1 CPU statistics, as reported by the sar utility
CPU Statistics  Description 

%usr 

percentage of time in which the processor is running in user mode 

%sys 

percentage of processes running in system time 

%wio 

percentage of time the processor spends waiting on I/O requests 

%idle 

percentage of time that the processor is idle 

Using the mpstat Utility

The mpstat utility is similar to sar in that its first argument is the polling interval time in seconds. The second argument to sarsar is the number of iterations.

The mpstat command:

$ mpstat 1 3

reports three processor statistics in one second intervals. For example:

$ mpstat 1 3
CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
  0    1   0    0   268   64  148   11    0    0    0    33    3   5   0  92
  0    5   0    0   250   49  157   13    0    1    0   357    2   0   0  98
  0    0   0    0   247   47  134    8    0    0    0   326    0   0   0 100

The mpstat utility reports the statistics per processor, as shown in Table 2-2.

Table 2-2 CPU statistics, as reported by the mpstat utility
Statistic  Description 

CPU 

processor ID 

minf 

number of minor faults 

mjf 

number of major faults 

xcal 

number of inter-processor cross calls 

Intr 

number of interrupts 

ithr 

number of interrupts as threads 

csw 

number of context switches 

icsw 

number of involuntary context switches 

migr 

number of thread migrations to another processor 

smtx 

number of spins for a mutex (mutual exclusion) lock, which means the lock was not obtained on the first attempt 

srw 

number of spins on reader-writer lock, which means the lock was not obtained on the first attempt 

syscl 

number of system calls 

usr 

percentage of time the processor spent in user mode 

sys 

percentage of time that the processor spent in system time 

wt 

percentage of time that the processor spent in wait time (waiting on an event) 

idl 

percentage of time that the processor spent in idle time 

Monitoring Network Traffic

You can use network monitoring tools, such as snoop on Solaris or Network Monitor on Windows NT, to verify the status of a request as it is being transmitted across the network.

Using the snoop Utility

Following are examples of how you can use the snoop utility to examine network packets. Using snoop in conjunction with netstat provides a good picture of network activity.

You can use the snoop command with arguments to specify how you want to capture and/or save network packets.

Command  Result 

snoop 

Captures and displays all packets as they are received.  

snoop Athena 

Captures and displays all incoming and outgoing packets from host Athena.  

snoop -O Gods Athena Zeus 

Captures all incoming and outgoing packets between hosts Athena and Zeus, and saves them to a file named Gods.  

You can use different command options to view packets captured in a file. For example, the command below displays the contents of the Gods file with timestamps relative to the first packet displayed.

prompt>snoop -i Gods -t r | more

Below is an example of using snoop to diagnose a suspected problem related to the FIN_WAIT_2 state:

prompt>snoop -i Gods | grep FIN

The first column of the output contains the packet numbers; you can get detailed information about a packet by typing:

prompt>snoop -i Gods -v -p<packet number>

Monitoring the Web Server

Monitoring activity on the system is essential to performance tuning. The Oracle HTTP Server provides server side status information, including current server statistics, via the mod_status module. To obtain these server status reports, you must configure the web server as described in the following sections.

Using the mod_status Utility to Monitor the Web Server

To enable monitoring, edit the httpd.conf file to replace your_domain.com with the hostname of the computer from which you want to monitor.

<Location /server-status>
SetHandler server-status
Order deny, allow
Deny from all
Allow from
your_domain.com
</Location>

Ensure that the ExtendedStatus directive is set to On, so that the maximum amount of information is displayed.

When you allow access from all domains, instead of just your_domain.com, you can monitor the server from machines outside of your domain, but be aware of the security implications of this: your server status is accessible from any site. It is probably best to specify the domain(s) from which you want to monitor your system.

With monitoring enabled, you can view current statistics from http://hostname:port/server-status where hostname:port is the hostname and port you want to monitor. These statistics help you to gain insight on how busy your system is.

The display includes:

Figure 2-1 is a screen capture of a server status page with ExtendedStatus turned on.

Figure 2-1 Server status page


Text description of svrstat.gif follows.
Text description of the illustration svrstat.gif

Interpreting Server Status Information

The display (with ExtendedStatus enabled) shows that 6 requests are being processed and four servers are idle. You can determine what stage of processing each server is in from the value in the M (Mode column).In Figure 2-1, 6 servers are sending replies and 4 servers are waiting for connections.

If your system has poor response times, or you suspect that httpd processes have stopped responding, look at the Req (request) column. It shows the number of milliseconds required to process the most recent request. Check to see if this number is greater than the time expected to service the request. If, after a request has been completed, there is a W in the M (mode) column for the process, the process is probably not responding.

Another situation that is important to monitor is that of the system being CPU bound, where CPU utilization is around 90%. The server status page displays CPU usage and the number of processes spawned. If the system is approaching the httpd process limit (the MaxClients directive's setting in httpd.conf), performance is poor, and the processes are all always busy, you may need to change your MaxClients setting. See "Configuring the MaxClients Parameter".

Customizing the Server Status display

Figure 2-1 is a snapshot of a server for a moment in time. You can get updated server statistics at any interval you choose by including the refresh parameter in the server-status URL:

http://servername:port/server-status?refresh=x

where servername:port is the name of the server and port number you are monitoring, and x is an integer representing the number of seconds after which the data is refreshed. For example, specify refresh=3 to update statistics every 3 seconds.

You may also find it useful to have the statistics displayed in a machine-readable format, for processing in a data analysis or spreadsheet program. To do this, add auto to the end of the URL, as shown below:

http://servername:port/server-status?auto

Figure 2-2 Server statistics display


Text description of svstauto.gif follows.
Text description of the illustration svstauto.gif

Logging Server Statistics to a File

The Apache Group provides a Perl script, log_server_status, to automate server monitoring. It is included in the $ORACLE_HOME/Apache/Apache/bin/ directory.

The script is designed to be run by cron (or an equivalent daemon that executes commands at intervals). To use the script, you must modify the following configuration variables in the script as shown in Table 2-3.

Table 2-3 Log status script variables
Variable  Value 

$wherelog 

The pathname of the log file location, for example:

/private/admin/logs/

The script creates a file name, such as: 20010945.  

$port 

Port number of the server to monitor. The default is 80.  

$server 

The server host name. The default is localhost

$request 

The server status request with the auto parameter as entered in the browser, for example:

http://servername:port/server-status?auto
 

Enabling server status is very useful if an httpd process is not responding, and you need to identify that process. Operating system utilities such as ps, top, or pmap do not identify which process is not responding.

Monitoring JServ Processes

After you start the Oracle9i Application Server, you can check to ensure that all JServ processes have started normally. If performance is degraded during operation, you can quickly determine if this is because JServ processes have terminated by looking at the Status column (each configured process has a status of Up or Down).

  1. Remove the comments in the JServ status handler section of the jserv.conf file to enable monitoring and specify the host(s) that can access JServ status (the default is localhost). Be aware of security implications when selecting the hosts that will be allowed to access status information on your system.

    	<Location /jserv/>
    	SetHandler jserv-status
    		order deny, allow
    		deny from all 
    		allow from hostname_1.com 
    		allow from hostname_2.com 
    	</Location>
    
    
    
    
  2. Type the following into your browser:

    	http://hostname:port/jserv/
    
    
    
    

The port must be the port on which the web server listens (found in the httpd.conf file). Always include the trailing slash (/) in this URL. A "not found" error occurs if you omit the trailing slash.

A Configured Hosts column displays links to hosts.

  • Click the host to monitor.

    The JServ status information for the host displays as shown in Figure 2-3.

    Figure 2-3 JServ status display


    1


    Note:

    The JServ status monitor shows all of the JServ processes that are configured in the jserv.conf file, but not all of these may have been started, or any of them could be terminated. For example, Figure 2-3 shows four processes, but only two have a Status of Up (indicating that the process is able to service requests).  



    Text description of jsrvstat.gif follows.
    Text description of the illustration jsrvstat.gif

    The Status column shows the current shared memory (shm) state of each process.


    Note:

    The Status column is populated only for processes that are started in manual mode. It is not populated for a single process started in automatic mode.  


    The symbols that appear in parentheses after the word Up or Down have the following meanings:

    Symbol  Meaning 

    + 

    The process is running.  

    - 

    The process is stopped. 

    X 

    The process was terminated in a harsh shutdown. (existing requests were not handled before the process was terminated).  

    / 

    The process was terminated in a graceful shutdown (existing requests were handled before the process was terminated).  


  • Go to previous page Go to next page
    Oracle
    Copyright © 2001 Oracle Corporation.

    All Rights Reserved.

    Library

    Contents

    Index