Page 1
Oracle9 i Application Server Oracle HTTP Server powered by Apache Performance Guide Release 1.0.2 for AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, Linux Intel, and Sun Solaris Intel October 2000 Part No. A86828-01...
Contents Send Us Your Comments ........................vii Preface ................................ix Performance Overview Performance Terms ..........................1-2 What is Performance Tuning? ......................1-2 Response Time ..........................1-3 System Throughput........................1-4 Wait Time............................1-4 Critical Resources ......................... 1-5 Effects of Excessive Demand....................... 1-6 Adjustments to Relieve Problems ....................
Page 4
Monitoring the Web Server....................... Using the mod_status Utility ...................... 2-4 Logging Server Statistics to a File....................2-6 Monitoring JServ Processes ......................2-8 Sizing and Configuration Sizing your Hardware and Resources..................... 3-1 Understanding Concurrent Users and User Population ............. 3-1 Determining CPU Requirements....................3-3 Secure Sockets Layer Impact on CPU Requirements ..............
Page 5
Using Single Thread Model Servlets..................5-7 What is OracleJSP? ..........................5-8 OracleJSP Page Performance Tuning ....................5-8 Impact of Session Management....................5-8 Developer Mode ........................... 5-9 Buffering ............................5-9 Enhancing OracleJSP Performance .................... 5-9 Index...
Send Us Your Comments Oracle9 i Application Server, Oracle HTTP Server powered by Apache Performance Guide, Release 1.0.2 Part No. A86828-01 Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this publication. Your input is an important part of the information used for revision. Did you find any errors? Is the information clearly presented? Do you need more information? If so, where?
Preface Audience This guide is written for Oracle Internet Application Server 8i developers and system administrators who are responsible for configuring and tuning the Oracle HTTP Server powered by Apache. Assumptions There are many sources of information on configuring and tuning web servers, Apache in particular.
Page 10
Convention Example Explanation italics file1 Identifies a variable in text; replace this place holder with a specific value or string. angle brackets Identifies a variable in code; replace this <filename> place holder with a specific value or string. courier Text to be entered exactly as it appears. Also owsctl start wrb used for functions.
Page 11
Product and Documentation For U.S.A customers, Oracle Store is at: http://store.oracle.com Links to Stores in other countries are provided from this site. Product documentation can be found at: http://docs.oracle.com Customer Service Global Customer Service contacts are listed at: http://www.oracle.com/support Education and Training Training information and worldwide schedules are available from: http://education.oracle.com Oracle Technology Network...
Performance Terms Performance Terms Following are performance terms used in this book: concurrency The ability to handle multiple requests simultaneously. Threads and processes are examples of concurrency mechanisms. latency The time that one system component spends waiting for another component in order to complete the entire task. Latency can be defined as wasted time.
What is Performance Tuning? Wait Time Critical Resources Effects of Excessive Demand Adjustments to Relieve Problems Response Time Because response time equals service time plus wait time, you can increase performance in this area by: Reducing wait time Reducing service time Figure 1–1 illustrates ten independent tasks competing for a single resource.
What is Performance Tuning? In parallel processing with multiple resources, more resources are available to the tasks. Each independent task executes immediately using its own resource: no wait time is involved. System Throughput System throughput is the amount of work accomplished in a given amount of time. You can increase throughput by: Reducing service time Reducing overall response time by increasing the amount of scarce resources...
What is Performance Tuning? Critical Resources Resources such as CPU, memory, I/O capacity, and network bandwidth are key to reducing service time. Adding resources increases throughput and reduces response time. Performance depends on these factors: How many resources are available? How many clients need the resource? How long must they wait for the resource? How long do they hold the resource?
What is Performance Tuning? Effects of Excessive Demand Excessive demand increases response time and reduces throughput, as shown in Figure 1–4. If there is any possibility of the demand rate exceeding the achievable throughput, a demand limiter (such as MaxClients in the Oracle HTTP Server and security.maxConnections in JServ) is essential.
Evaluating Performance Setting Performance Targets Whether you are designing or maintaining a system, you should set specific performance goals so that you know how and what to optimize. If you alter parameters without a specific goal in mind, you can waste time tuning your system without significant gain.
Performance Methodology Performance Methodology Achieving optimal effectiveness in your system requires planning, monitoring, and periodic adjustment. The first step in performance tuning is to determine the goals you need to achieve and to design effective usage of available technology into your applications.
Performance Methodology Factors in Improving Performance Performance spans several areas: Application design: Designing applications that efficiently utilize hardware resources and handle increasing numbers of users effectively. Sizing and configuration: Determining the type of hardware needed to support your performance goals. See Chapter 3, "Sizing and Configuration".
Oracle HTTP Server powered by Apache Apache JServ OracleJSP See the Oracle9i Application Server Overview Guide for a list of publications that describe other components. Figure 1–6 Oracle9i Application Server architecture 1-10 Oracle HTTP Server powered by Apache Performance Guide...
Monitoring Your Web Server This chapter describes utilities and processes you can use to gather information from your system. This information helps you to determine the best use of your resources. Contents Monitoring Processor Use Monitoring the Web Server Monitoring the Web Server Monitoring JServ Processes Monitoring Your Web Server 2-1...
Monitoring Processor Use Monitoring Processor Use To determine process utilization, you should gather CPU statistics. You should also monitor system scalability by adding users and increasing the system workload. Use utilities such as sar (System Activity Reporter) and mpstat to monitor process use.
Monitoring the Web Server The sar command (-u option) provides the following statistics: Table 2–1 CPU statistics, as reported by the sar utility CPU Statistics Description percentage of time in which the processor is running in user %usr mode percentage of processes running in system time %sys percentage the processor spends waiting on I/O requests %wio...
Monitoring the Web Server Using the mod_status Utility To enable monitoring, edit the httpd.conf file to replace your_domain.com with the hostname of the server you want to monitor. <Location /server-status> SetHandler server-status Order deny, allow Deny from all Allow from your_domain.com </Location>...
Page 27
Monitoring the Web Server Figure 2–1 Server status page 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.
Monitoring the Web Server 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.
Page 29
Monitoring the Web Server 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: Table 2–2 Log status script variables Variable Value The pathname of the log file location, for example: $wherelog...
Monitoring JServ Processes Monitoring JServ Processes After you start the Oracle9i Application Server, you can check to ensure that all JServ processes have started normally. 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).
Page 31
Monitoring JServ Processes Figure 2–3 JServ status display The Status column shows the current shared memory (shm) state of each process. Monitoring Your Web Server 2-9...
Page 32
Monitoring JServ Processes The Status column is populated only for processes that are Note: 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...
Sizing and Configuration This chapter provides guidelines for sizing and configuration which can help you meet performance goals. It also discusses performance factors, such as memory consumption, I/O issues, and network and software constraints. Contents Sizing your Hardware and Resources Understanding Concurrent Users and User Population Determining CPU Requirements Determining Memory Requirements...
Page 34
Understanding Concurrent Users and User Population relationship between the number of potential users and the number of concurrent users. This is determined by the think time and the average response time for your application. To determine memory requirements, you also need to consider the number of concurrent executing users (not the total user population) times the cost per user.
Determining Memory Requirements Determining CPU Requirements For most applications, the majority of the CPU utilization is spent in processing the application’s code. The CPU requirement of any application depends on its complexity and workload, as shown in Table 3–2. You will need to monitor the CPU requirements of applications throughout the development cycle.
Determining Memory Requirements Memory for Non-HTTP Server Software and Operating System HTTP Server Memory Requirements JServ Memory Requirements Determining Java Heap Size Servlet and OracleJSP pages Memory Requirements Number of JServ Processes Memory for Non-HTTP Server Software and Operating System In an idle system with memory resources freely available, your operating system statistics may indicate that the resident memory usage is close to the virtual size.
Determining Memory Requirements To maximize performance, set the maximum heap size to accommodate application requirements. To determine how much Java heap you need, include calls in your program to the Runtime.getRuntime().totalMemory() and Runtime.getRuntime().freeMemory methods in the java.lang package. Subtract free memory from total memory; the difference is the amount of heap that the application consumed.
Determining Memory Requirements The amount of memory needed depends on whether sessions are used; a session consumes about 0.5KB. For maximum performance, if sessions are not being used, turn them off in the OracleJSP application as follows: <%@ page session=”false” %> <html><body>...
Page 39
Determining Memory Requirements Figure 3–1 Request distribution Sizing and Configuration 3-7...
Page 40
Determining Memory Requirements 3-8 Oracle HTTP Server powered by Apache Performance Guide...
Optimizing HTTP Server Performance This chapter provides information on improving the Oracle HTTP Server’s performance, including tuning TCP parameters, the effects of changing the MaxClients parameter, SSL caching, and logging. Contents TCP Tuning MaxClients SSL Session Caching Impact of Logging HTTP/1.1 Apache Versions Optimizing HTTP Server Performance 4-1...
TCP Tuning TCP Tuning Correctly tuned TCP parameters can improve performance dramatically. This section contains recommendations for TCP tuning and a brief explanation of each parameter. The table below contains recommended TCP parameter settings. Table 4–1 Recommended TCP parameter settings for Intel Solaris Parameter Setting Comments...
TCP Tuning Table 4–4 AIX TCP Parameters (using no command) Default Parameter Model Value Recommended Value rfc1323 /etc/rc.net 65,536 1,31,072 sb_max /etc/rc.net 1,024 tcp_mssdflt /etc/rc.net ipqmaxlen /etc/rc.net 16,384 65,536 tcp_sendspace /etc/rc.net 16,384 65,536 tcp_recvspace /etc/rc.net xmt_que_size /etc/rc.net Linux Tunables Raising Network Limits on Linux Systems for 2.1.100 or greater Linux only allows you to use 15 bits of the TCP window field.
Page 45
TCP Tuning You will find some other possibilities to tune TCP in /proc/sys/net/ipv4/: tcp_timestamps tcp_windowscaling tcp_sack There is a brief description of TCP parameters in /Documentation/networking/ip-sysctl.txt. Tuning at Compile Time All the above TCP parameter values are set default by a header file in the Linux kernel source directory /LINUX-SOURCE-DIR/include/linux/skbuff.h These values are default.
Page 46
TCP Tuning With the tuned TCP stacks, it was possible to get a maximum throughput between 1.5 and 1.8 Mbits via a 2Mbit satellite link, measured with netperf. Setting TCP parameters To set the connection table hash parameter, on Intel Solaris, you must add the following line to your /etc/system file, and then restart the system: set tcp:tcp_conn_hash_size=32768 On Tru64, tcbhashsize can be set at /etc/sysconfigtab.
Page 47
TCP Tuning Specifying Retention time for Connection Table entries The TCP connection table maintains data associated with connections. The server maintains a TCP connection table entry for some time after a connection is closed, so that it can identify and properly dispose of any leftover incoming packets from the client.
Page 48
TCP Tuning On most web servers, the defaults will be sufficient, but if you have more than 1024 concurrent users, these settings may be too low. In that case, connections will be dropped in the handshake state because the queues are full. You can determine whether this is a problem on your system by inspecting the values for tcpListenDrop, tcpListenDropQ0, and tcpHalfOpenDrop with netstat -s.
You can configure this parameter in the httpd.conf file up to a maximum of 1024 in Oracle9i Application Server v. 1.0.2 (in the previous version, the maximum was 256). The default is 150, which should be adequate for most uses.
SSL Session Caching could be reduced, to act as a throttle on the number of concurrent requests on the server. SSL Session Caching The Oracle HTTP server caches a client’s SSL session information by default. With session caching, only the first connection to the server incurs high latency. For example, in a simple test to connect and disconnect to an SSL-enabled server, the elapsed time for 5 connections was 11.4 seconds without SSL session caching.
HTTP/1.1 to log IP addresses. You can resolve IP addresses to host names off-line, with the logresolve utility (found in the $ORACLE_HOME/Apache/Apache/bin/ directory). For more information, see Dale Gaudet’s Apache Perfor ance Notes at: http://www.apache.org/docs/misc/perf-tuning.html Error logging The server notes unusual activity in an error log. The ErrorLog and LogLevel directives identify the log file and the level of detail of the messages recorded.
Page 52
HTTP/1.1 Shorter Response Times Persistent connections can improve total response time for a web interaction that involves multiple HTTP requests, because the delay of setting up a connection only happens once. Consider the total time required, without persistent connections, for a client to retrieve a web page with three images from the server.
Page 53
HTTP/1.1 This is a 20% reduction in service time. When the system is under load, the benefit of reducing connection time with persistent connections is even greater, due to the corresponding reduction of the TCP queue. Reduction in Server Workload Another benefit of persistent connections is reduction of the work load on the server.
Apache Versions The problem is that when a connection becomes idle, and the server closes it because the keep alive time limit has expired, the client host may not perform the TCP protocol steps required to complete the closure of the connection. The host, having sent the close request, is left with the connection in the FIN_WAIT_2 state taking up memory until it gets the appropriate packets back from the client, or until an internal flush occurs.
Optimizing Apache JServ This chapter describes the JServ architecture, and discusses ways you can improve its performance. It also includes performance information on OracleJSP pages (the Oracle implementation of Sun Microsystems’ JavaServer Pages 1.1.) Contents JServ Overview Optimizing Servlet Performance What is OracleJSP? OracleJSP Page Performance Tuning Optimizing Apache JServ 5-1...
JServ Overview JServ Overview Apache JServ is made up of an Apache module called mod_jserv, which runs in the httpd process, and a servlet engine, which runs in a Java process. mod_jserv, which is implemented in C, functions as a dispatcher, routing each servlet request to a JServ process for execution.
Optimizing Servlet Performance Optimizing Servlet Performance This section discusses strategies for optimizing JServ performance: loading servlets when starting the JVM, and load balancing. The terms “repository” and “zone” are used in this discussion. Servlets, repositories, and zones are analogous to files, directories and virtual hosts. A servlet is a single unit, a repository is a collection of servlets, and a zone is a collection of repositories.
Optimizing Servlet Performance parameters to false, since there is a performance cost in checking the repositories on every execution of a servlet. Change these parameters in the zone properties file: autoreload.classes=false autoreload.file=false Load Balancing It is often beneficial to spread the servlet application load among multiple JServ processes, especially when the application is run on a multiprocessor or if the servlets and HTTP server are run on separate nodes.
Page 59
Optimizing Servlet Performance Edit jserv2.properties as follows: port=8002 log.file=/usr/local/jserv/logs/jserv2.log If your HTTP server will be running on a different host than Note: the JServ processes, you must also add the IP address of the host running the HTTP server to the security.allowedAddresses parameter in each jserv.properties file.
Page 60
Optimizing Servlet Performance ApJServHost JServ2 ajpv12://127.0.0.1:8002 ApJServRoute JS1 JServ1 ApJServRoute JS2 JServ2 ApJServShmFile /usr/local/apache/logs/jserv_shm The ApJServMount directive, with /servlets balance://set/root, now balances requests for servlets in /servlets between JServ1 and JServ2. The ApJServBalance directive identifies JServ1 and JServ2 as the processes that share the load.
Optimizing Servlet Performance If the request is not part of a session, mod_jserv selects an engine based on the process ID of the httpd process and the number of entries in the list of available JServs, as follows: JServ_id to handle the request = httpd_pid % number of JServs in the list This method distributes requests across the available JServ engines fairly evenly.
What is OracleJSP? singleThreadModelServlet.initialCapacity = 10 singleThreadModelServlet.incrementCapacity = 0 singleThreadModelServlet.maximumCapacity = 10 The value for Warning: singleThreadModelServlet.maximumCapacity in the zone properties file must be at least as large as the value for security.maxConnections in the jserv.properties file. If it is not, and the number of requests sent to the JServ process exceeds the maximum capacity, requests will fail.
OracleJSP Page Performance Tuning Developer Mode Another parameter that has a significant effect on performance is developer mode. It is a useful feature for debugging during development, but it degrades performance. The default value is true, so you will need to set it to false in the jserv.properties file as follows: servlet.oracle.jsp.JspServlet.initArgs=developer_mode=false With developer mode set to true, OracleJSP and the servlet engine examines every...
Page 64
OracleJSP Page Performance Tuning Update statement batching The JDBC driver accumulates a number of execution requests (the batch value) and passes them to the database to be processed at the same time. You can configure the batch value to control how frequently processing occurs. JDBC statement caching Cache executable statements that are repeatedly used, to avoid re-parsing, statement object recreation, and recalculation of parameter size definitions.
Need help?
Do you have a question about the Oracle9i and is the answer not in the manual?
Questions and answers