|Oracle9i Application Server Performance Guide
Release 2 (9.0.2)
Part Number A95102-02
This chapter provides guidelines for improving the performance of Oracle9iAS Web Cache. It focuses on suggestions about how to size the cache, including the number of CPUs, the amount of memory, the network bandwidth, and the number of network connections.
This chapter contains the following topics:
See the Oracle9iAS Web Cache Administration and Deployment Guide for further details.
Oracle9iAS Web Cache is designed to use one or two CPUs. Because Oracle9iAS Web Cache is an in-memory cache, it is rarely limited by CPU cycles. Additional CPUs do not increase performance significantly. However, the speed of the processors is critical--use the fastest CPUs you can afford.
Note that Oracle9iAS Web Cache is limited by the available addressable memory. Additional memory can increase performance and scalability. See "Configure Enough Memory for Oracle9iAS Web Cache" for information about the amount of memory you need.
Oracle9iAS Web Cache has three processes: one for the admin server, one for the auto-restart monitor, and one for the cache server.
For a cost-effective way to run Oracle9iAS Web Cache, run it on a fast two-CPU computer with lots of memory. See Oracle9iAS Web Cache Deployment and Administration Guide for information about various deployment scenarios.
For a Web site with more than one Oracle9iAS Web Cache instance, consider installing each instance on a separate two-CPU node, either as part of a cache cluster or as standalone instances. When Oracle9iAS Web Cache instances are on separate nodes, you are less likely to encounter operating system limitations, particularly in network throughput. For example, two caches on two separate two-CPU nodes are less likely to encounter operating system limitation than two caches on one four-CPU node.
Of course, if other resources are competing with Oracle9iAS Web Cache for CPU usage, you should take the requirements of those resources into account when determining the number of CPUs needed. Although a separate node for Web Cache is optimal, you can also derive a significant performance benefit from Web Cache running on the same node as the rest of the application server.
To avoid swapping documents in and out of the cache, it is crucial to configure enough memory for the cache. Generally, the amount of memory (maximum cache size) for Oracle9iAS Web Cache should be set to at least 256 MB. By default, the maximum cache size is set to 50 MB, which is sufficient only for initial post-installation testing.
To be more precise in determining the maximum amount of memory required, you can take the following steps:
One way to do this is to look at existing Web server logs for one day to see what documents are popular. From the list of URLs in the log, decide which ones you want to cache. Retrieve the documents and get the size of each document.
The amount of memory that Oracle9iAS Web Cache uses to store a document depends on the document size:
Use the following formula to determine an estimate of the maximum memory needed:
In the formula:
Xis the number of documents smaller than 4 KB.
4KBis the buffer size for the HTTP body for documents smaller than 4 KB.
4KBis the buffer size for the HTTP response header.
Yis number of documents that are 4 KB or larger.
[m/32]is the ceiling of
m(the average size, in kilobytes, of documents 4 KB or larger) divided by
32. A ceiling is the closest integer that is greater than or equal to the number.
32KBis the buffer size for the HTTP body for documents that are 4 KB or larger.
basememis the base amount of memory needed by Oracle9iAS Web Cache to process requests. This amount includes memory for internal functions such as lookup keys and timestamps. The amount needed depends on the number of concurrent requests and on whether or not the requests include Edge Side Includes (ESI). ESI is a markup language to enable partial-page caching of HTML fragments.
For non-ESI requests, each concurrent request needs roughly 6 KB to 25 KB of memory. For example, to support 1000 concurrent requests, you need between 6 MB and 25 MB of memory.
For ESI requests, each concurrent request needs roughly the following amount of memory:
For example, for a document with 10 ESI fragments, use the following calculation:
That is, you need between 120 KB and 330 KB of memory for one 10-fragment document. To support 1000 concurrent requests, you need roughly between 120 MB to 330 MB of memory.
For example, assume that you want to cache 5000 documents that are smaller than 4 KB and 2000 documents that are 4 KB or larger and that the larger documents have an average size of 54 KB. The documents do not use ESI. You expect to process 500 documents concurrently. Use the formula to compute the maximum memory:
Using the formula, you need:
This results in an estimate of 179,000 KB to 188,500 KB of memory needed.
Even though you specify that certain documents should be cached, not all of the documents are cached at the same time. Only those documents that have been requested and are valid are stored in the cache. As a result, only a certain percentage of your documents are stored in the cache at any given time. That means that you may not need the maximum memory derived from the preceding formula.
To specify the maximum cache size, take the following steps:
The Edit Resource Limits dialog box appears.
Remember that the cache is empty when Oracle9iAS Web Cache starts. For monitoring to be valid, make sure that the cache is fully populated. That is, make sure that the cache has received enough requests so that a representative number of documents are cached.
The Web Cache Statistics page provides information about the current memory use and the maximum memory use.
To access the Web Cache Statistics page, from the navigator pane, select Administration > Monitoring > Web Cache Statistics. Note the following metrics in the Cache Overview table:
If the Current Allocated Memory is greater than the Current Action Limit, Oracle9iAS Web Cache begins garbage collection. That is, Oracle9iAS Web Cache removes the less popular and less valid documents from the cache in favor of the more popular and more valid documents to obtain space for new HTTP responses without exceeding the maximum cache size.
If the Current Allocated Memory is close to or greater than the Current Action Limit, increase the maximum cache size to avoid swapping documents in and out of the cache. Use the Cache-Specific Configuration > Resource Limits page to increase the maximum cache size.
When you use Oracle9iAS Web Cache, make sure that each node has sufficient network bandwidth to accommodate the throughput load. Otherwise, the network may be saturated but Oracle9iAS Web Cache has additional capacity. For example, if your application generates more than 100 megabits of data per second, 10/100 Megabit Ethernet will likely be saturated.
If the network is saturated, consider using Gigabit Ethernet rather than 10/100 Megabit Ethernet. Gigabit Ethernet provides the most efficient deployment scenario to avoid network collisions, retransmissions, and bandwidth starvations. Additionally, consider using two separate network cards: one for incoming client requests and one for requests from the cache to the application Web server.
If system monitoring shows that the network is under utilized and throughput is less than expected, check whether or not the CPUs are saturated.
It is important to specify a reasonable number for the maximum connection limit for the Oracle9iAS Web Cache server. If you set a number that is too high, performance can be affected, resulting in slower response time. If you set a number that is too low, fewer requests will be satisfied. You must strike a balance between response time and the number of requests processed concurrently.
To help determine a reasonable number, consider the following factors:
ttcp, to determine how quickly your system processes a page.
Use various tools, such as those available with the operating system and with Oracle9iAS Web Cache, to help you determine the maximum number of connections. For example, the
-a command enables you to determine the number of established connections; the
ttcp utility enables you to determine how fast a page is processed. The Oracle9iAS Web Cache Manager provides statistics on hits and misses.
To set the maximum number of incoming connections, take the following steps:
The Edit Resource Limits dialog box appears.
Do not set the value to an arbitrary high value. Oracle9iAS Web Cache sets aside some resources for each connection, which could adversely affect performance. For many UNIX systems, 5000 connections is usually a reasonable number.
On most UNIX platforms, each client connection requires a separate file descriptor. The Oracle9iAS Web Cache server attempts to reserve the maximum number of file descriptors when it starts. If the
webcachectl utility can be run as
root, you can increase this number. For example, on Sun Solaris, you can increase the maximum number of file descriptors by setting the
rlim_fd_max parameter. If
webcachectl is not able to run as
root, the Oracle9iAS Web Cache server logs an error message and fails to start.
To run the
webcachectl utility as the root user, ensure that
root.sh was run during installation. If
root.sh was not run during installation, then run it at this time from the
$ORACLE_HOME directory. See the Oracle9iAS Web Cache Administration and Deployment Guide for further details regarding Solaris commands and information about the
Oracle9iAS Web Cache uses the following formula to calculate the maximum number of file descriptors to be used:
In the formula:
Max_File_Descis the maximum number of file descriptors to be used.
Curr_Max_Connis the current maximum incoming connections limit for Oracle9iAS Web Cache. You set the maximum number of incoming connections using the Cache-Specific Configuration > Resource Limits page of the Oracle9iAS Web Cache Manager.
In a cache cluster environment,
Curr_Max_Conn also includes the cluster member capacity, which is the incoming connections from peer caches. You set the capacity using the Administration > Cluster Configuration page of the Oracle9iAS Web Cache Manager.
Total_WS_Capacityis the sum of the capacity for all configured application Web Servers. You set the capacity using the General Configuration > Application Web Servers page of Oracle9iAS Web Cache Manager.
In a cache cluster environment, the capacity is divided among the cache cluster members, using the following formula:
In the formula,
Sum_Web_Server_Capacity is the sum of the capacity of all configured application Web servers;
n is the number of cache cluster members. For example, assume you have two configured application Web Servers.
Web_Server_A has a capacity of 200 and
Web_Server_B has a capacity of 250. Also, assume you have a cluster with three caches. The
Total_WS_Capacity is 150, as the following example calculates:
Outgoing_Cluster_Connis the total of outgoing connections to peer caches in a cache cluster. This value is zero if you do not have a cache cluster. To compute this value, use the following formula:
In the formula,
Sum_Cluster_Capacity is the sum of the capacity of all other Web caches in a cluster;
n is the number of cache cluster members. For example, assume you have a cluster with three caches.
Cache_A has a capacity of 100,
Cache_B has a capacity of 150, and
Cache_C has a capacity of 200. The
Cache_A is 175, computed as follows:
To set the capacity of caches in a cluster, select Administration > Cluster Configuration from the navigator pane of Oracle9iAS Web Cache Manager.
100is the number of connections reserved for internal use by Oracle9iAS Web Cache.
On Windows NT and Windows 2000, the number of file handles as well as socket handles is limited only by available kernel resources, more precisely, by the size of paged and non-paged pools. However, the number of active TCP/IP connections is restricted by the number of TCP ports the system can open.
The default maximum number of TCP ports is set to 5000 by the operating system. Of those, 1024 are reserved by the kernel. You can modify the maximum number of ports by editing the Windows registry. Windows NT and Windows 2000 allow up to 65534 ports.
To change the default, you must add a new value to the following registry key:
Add a new value, specifying the following:
The total of the maximum number of incoming connections and cluster member capacity should not be set to a number greater than the number of TCP ports minus 1024. (You set the maximum number of incoming connections using the Cache-Specific Configuration > Resource Limits page of the Oracle9iAS Web Cache Manager. You set the cluster member capacity using the Administration > Cluster Configuration page.)
On Windows NT and Windows 2000, Oracle9iAS Web Cache does not attempt to reserve file handles or to check that the number of current maximum incoming connections is less than the number of TCP ports.