Download as pdf or txt
Download as pdf or txt
You are on page 1of 52

33

Tuning the Oracle Application Server


Middle Tier

Copyright © 2004, Oracle. All rights reserved.


Objectives

After completing this lesson, you should be able to do


the following:
• Describe Oracle Application Server performance
methodology
• Monitor and tune the performance of Oracle HTTP
Server (OHS)
• Monitor and tune performance of OC4J processes
and applications
• Monitor and tune the performance of OracleAS
Web Cache
• Monitor and tune OracleAS Forms Services

33-2 Copyright © 2004, Oracle. All rights reserved.


Performance Tuning Methodology

• Performance tuning involves


– Determining measurable goals of performance
– Translating the goals into observable metrics for
components
– Regular monitoring of metrics
– Evolving optimization techniques
– Implementing the appropriate tuning solution
• Some of the parameters used in evaluating
performance are:
– Response Time, System Throughput, Wait Time
• Periodic monitoring helps in anticipating and
overcoming performance challenges.

33-3 Copyright © 2004, Oracle. All rights reserved.


Monitoring the Performance of Oracle
Application Server

• The Oracle Application Server performance


metrics are measured automatically and
continuously.
• These metrics can be accessed using the
Application Server Control.
• Application Server Control is the central tool to
configure, manage monitor and tune the
components of Oracle Application Server.
• Other tools such as dmstool

33-4 Copyright © 2004, Oracle. All rights reserved.


OracleAS Hi-Av Tool (iHAT)

• iHAT is a monitoring tool that provides a graphic


snapshot of all processes managed by OPMN:
– Grid View: Provides status of all OracleAS
instances in a single window
– Instance View: Provides the complete process
topology view of Oracle Application Server
– Routing View: Monitors routing relationships
between OHS and OC4J
• To invoke iHAT, use the command:
java –jar ihat.zip <host>:<port>
For example:
java -jar ihat.zip edcdr2p1:6003
• A full list of iHAT options can be obtained with:
java -jar ihat.zip -h

33-5 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-6 Copyright © 2004, Oracle. All rights reserved.


iHAT: Using Web Browser

33-7 Copyright © 2004, Oracle. All rights reserved.


Other Monitoring Tools

Oracle Application Server also provides the following


monitoring tools:
• AggreSpy
– A prepackaged servlet that reports performance
metrics
– Reports performance data for an OracleAS instance
– Can be used only when the home OC4J component
is active
• dmstool
– Is located in the $ORACLE_HOME/bin directory
– Allows you to monitor a specific, a set, or all
performance metrics
– Allows you to specify a reporting interval

33-8 Copyright © 2004, Oracle. All rights reserved.


Comparison of Monitoring Tools

• Application Server Control:


– Is the preferred tool for management and
monitoring
– Is capable of enterprisewide monitoring
– Includes detailed as well as summarized
information as required
• AggreSpy can be used:
– For monitoring OC4J and OHS only
– To obtain detailed information about specific
component
• dmstool:
– Command Line tool
– Useful for support

33-9 Copyright © 2004, Oracle. All rights reserved.


Monitoring the Oracle HTTP Server

• Monitoring of the Oracle HTTP Server involves:


– Assessing the workload
– Investigating Oracle HTTP Server errors
– Categorizing Oracle HTTP Server problems
• Use the Performance region to drill down to
detailed monitoring.
• When assessing work load, ensure that you are
assessing a representative load.

33-10 Copyright © 2004, Oracle. All rights reserved.


Detailed Monitoring of OHS

33-11 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-12 Copyright © 2004, Oracle. All rights reserved.


Detailed Monitoring of OHS Logging

33-13 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-14 Copyright © 2004, Oracle. All rights reserved.


Categorized Monitoring with
Application Server Control

• Application Server Control allows you to analyze


the performance metrics in three categories:
– Module Metrics
– Virtual Host Metrics
– Child Server Metrics
• This categorization enables you to isolate
performance bottlenecks and fix them.

33-15 Copyright © 2004, Oracle. All rights reserved.


Module Metrics

• If OracleAS Web Cache is enabled, then the use of


http_core.c should be reduced.
• If mod_oc4j.c shows high activity, then drill down
to the J2EE Applications.

33-16 Copyright © 2004, Oracle. All rights reserved.


Virtual Host Metrics

33-17 Copyright © 2004, Oracle. All rights reserved.


Monitoring Child Server Processes

You should analyze the OHS child server processes if


your application server experiences delays or
deadlocks.

33-18 Copyright © 2004, Oracle. All rights reserved.


Monitoring OHS Using AggreSpy

http://<host:port>/j2ee/servlet/AggreSpy

33-19 Copyright © 2004, Oracle. All rights reserved.


Managing Server Processes

Directives in httpd.conf that affect OHS processes:


• StartServers
• MaxClients
• MaxKeepAliveRequests
• MaxRequestPerChild
• MaxSpareServers
• MinSpareServers
• Timeout
• KeepAlive
• ThreadsPerChild (on Windows platforms)

33-20 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-21 Copyright © 2004, Oracle. All rights reserved.


Monitoring Processor Usage

• On UNIX, you can use the sar or mpstat utilities


to monitor the processor usage.
• On Windows, you can use the Performance
Monitor.

33-22 Copyright © 2004, Oracle. All rights reserved.


Configuring OC4J for Performance

Configuring of OC4J for improving the performance


includes:
• Providing adequate memory resources
• Caching and reusing database connections
• Managing concurrency and limiting connections
• Load balancing
• Database monitoring and tuning

33-23 Copyright © 2004, Oracle. All rights reserved.


Monitoring OC4J Process or Instance

33-24 Copyright © 2004, Oracle. All rights reserved.


Monitoring J2EE Applications

33-25 Copyright © 2004, Oracle. All rights reserved.


Setting Java Options

You can set the following Java Options:


• Server Option
• Heap Size
• Stack Size
• Concurrent IO

33-26 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-27 Copyright © 2004, Oracle. All rights reserved.


Setting Up Data Sources

Performance depends on the settings for:


• connection pooling
• Maximum and minimum open connections
• Cached connection inactivity timeout
• Wait for free connection timeout
• Connection retry interval
• Maximum number of connection attempts
• JDBC statement cache size

33-28 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-29 Copyright © 2004, Oracle. All rights reserved.


Setting Up Open Connections

In a pooled data source:


• max-connections is the upper limit of number
connections to data source
• cacheScheme determines how max-connection is
interpreted
• Default cacheScheme is DYNAMIC_SCHEME
• min-connections is the level of connections
maintained
• inactivity-timeout specifies the time out for
inactive connections
• wait-time specifies the time to wait for obtaining
data source connection

33-30 Copyright © 2004, Oracle. All rights reserved.


Setting Up Open Connections

33-31 Copyright © 2004, Oracle. All rights reserved.


Setting Up Connection Attributes
Using Application Server Control

33-32 Copyright © 2004, Oracle. All rights reserved.


Tips for Tuning Servlets

1. Monitor the load on your server with respect to:


– The metric serviceRequest.avg
– The metric processRequest.avg
2. Watch for unused sessions observing:
– sessionActivation.active
– sessionActivation.completed
– session-timeout
3. Watch for slow servlet loading
– Enable load-on-startup for servlets that require
extra time to load.

33-33 Copyright © 2004, Oracle. All rights reserved.


Notes Only Page

33-34 Copyright © 2004, Oracle. All rights reserved.


Loading Servlet Classes at Startup

• Servlet classes are loaded when the first request


is made.
• This can imply varying performance for requests.
• The load-on-startup facility enables classes to
load when the application starts up.
• You can use the Application Server Control to
specify if a Web module is loaded at start up.

33-35 Copyright © 2004, Oracle. All rights reserved.


Tips for Tuning JSPs

The JSP developer can improve JSP performance by:


• Using the JESI and the Web Object Cache tag
library
• Tuning JSP code
The administrator can improve JSP performance by:
• Changing JSP parameters
• Using the main_mode parameter

33-36 Copyright © 2004, Oracle. All rights reserved.


Using the main_mode parameter

The main_mode parameter for each OC4J instance


controls the way run time operation is performed.
• recompile: This is the default value. The
dispatcher will check the timestamp of the JSP.
Retranslate and execute all reload if the timestamp
is different.
• reload: The dispatcher will check if any classes
have been modified since loading. Reload if the
timestamp is different.
• justrun: The dispatcher will not check if any
classes have been modified since loading.

33-37 Copyright © 2004, Oracle. All rights reserved.


Tips for Tuning EJBs

• The timeout parameter specifies the maximum


time taken for a transaction to finish before it is
rolled back due to a timeout.
• The default value for this parameter is 60,000
milliseconds (60 seconds).
• The timeout should be set to a value greater than
or equal to the timeouts used within individual
transactions.

33-38 Copyright © 2004, Oracle. All rights reserved.


OC4J-Specific Tips for Tuning EJBs

• OC4J specific attributes applying to all EJB are


stored in orion-ejb-jar.xml.
• The parameter call-timeout specifies maximum
time to wait before calling the EJB method.
• Default call-timeout for entity bean is 900000
ms and for session beans 0 (always).
• The parameter max-tx-retries specifies the
number of times to retry a transaction.
• The default max-tx-retries is three for both
session and entity beans.

33-39 Copyright © 2004, Oracle. All rights reserved.


Configuring orion-ejb-jar.xml

The orion-ejb-jar.xml contains the configuration


for EJB modules.
• cache-timeout: Time for which inactive stateless
session bean remains in the pool
• call-timeout: Time to wait for an EJB
• copy-by-value: To copy all parameters in EJB
calls
• max-tx-tries: Number of times to retry a failed
transaction
• persistence-filename: File in which session
details are stored for use across server restarts

33-40 Copyright © 2004, Oracle. All rights reserved.


Factors that Affect the Caching Efficiency

Some of the factors that affect the caching efficiency


are:
• Available resources: Memory and bandwidth
• Latency
• Response time
• Web Cache size
• Size of documents
• Cacheability rules
• Frequency of invalidation and nature of content
• Personalization and versions

33-41 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-42 Copyright © 2004, Oracle. All rights reserved.


Tuning Network Timeouts

• There are two types of Network Timeouts:


– Keep-Alive Timeout for Browser – default 5 seconds
– Origin Server Timeout – default 3600 seconds
• Keep Alive Timeout and Keep Alive need to be
configured for the Browser and Web Cache.
• Tune time outs based on the load tests.

Cache-Specific Configuration > Network Timeouts.

33-43 Copyright © 2004, Oracle. All rights reserved.


Connection Limit

To help determine a reasonable Connection Limit,


consider following factors:
• The number of concurrent clients to serve
• The average size of a page and the average
number of requests for page
• Network bandwidth
• How quickly a page is processed

Use the Resource Limits link in


Web Cache Manager

33-44 Copyright © 2004, Oracle. All rights reserved.


Cache Size Determination

• Cacheability rules determine if a document is to be


cached
• Memory for document body is allocated in
– 4KB chunks if the document size is less than 4KB
– 32KB chunks otherwise
• HTTP response headers use 4KB

Use the Resource Limits link in Web


Cache Manager

33-45 Copyright © 2004, Oracle. All rights reserved.


Invalidation Performance

To expedite invalidation, consider the following:


• Use basic invalidation requests for invalidating
single object
• Use substring matching for invalidating multiple
objects in advanced invalidations
• Use invalidation indexes to improve performance
of content traversal

33-46 Copyright © 2004, Oracle. All rights reserved.


Invalidating Multiple Objects
Using SUBSTRING

To send an advanced invalidation request with


substring matching do the following:
1. Specify the OTHER element in a manual
invalidation request that uses the
ADVANCEDSELECTOR element.
2. Specify the NAME attribute to use a value of URI,
BODY, or QUERYSTRING_PARAMETER.
3. Specify the TYPE attribute to use a value of
SUBSTRING.

33-47 Copyright © 2004, Oracle. All rights reserved.


Notes Page Only

33-48 Copyright © 2004, Oracle. All rights reserved.


Using Indexes to Improve Invalidation
Performance

• If invalidation requests use the


QUERYSTRING_PARAMETER, then index would be
helpful.
• Using index, Web Cache categorizes objects in
cache, and performs faster lookup.
• To specify an invalidation index, add an
INVALIDATIONINDEX element to the
webcache.xml.

33-49 Copyright © 2004, Oracle. All rights reserved.


Monitoring OracleAS Forms Services

• Use Application Server Control to monitor Forms


Services.

• Click the Forms instance to display the Forms


Services page to view information about:
– Status
– Configuration
– Load
– Response

33-50 Copyright © 2004, Oracle. All rights reserved.


Tuning Forms Services

• Run-time pooling for Forms Services provides


quick connections at server peak times.
• Set prestartRuntimes to true to enable run-time
pooling and pre start.
• Specify the number of run-time executables to be
prespawned with the parameter
initialRuntimes.
• Set the timeOut to 0 if you want all the spawned
executable to exist even when inactive.
• Set the minRuntimes to the number of spawned
executables to exist even when inactive.

33-51 Copyright © 2004, Oracle. All rights reserved.


Summary

In this lesson, you should have learned to do the


following:
• Describe the performance methodology
• Monitor and tune the performance of Oracle HTTP
Server (OHS)
• Monitor and tune performance of OC4J processes
and applications
• Monitor and tune the performance of OracleAS
Web Cache
• Monitor and tune OracleAS Forms Services

33-52 Copyright © 2004, Oracle. All rights reserved.

You might also like