Skip Headers

Oracle9i Application Server Performance Guide
Release 2 (9.0.2)

Part Number A95102-02
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

7
Optimizing Web Cache

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:


Note:

See the Oracle9iAS Web Cache Administration and Deployment Guide for further details.


Use Two CPUs for Oracle9iAS Web Cache

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.

Configure Enough Memory for Oracle9iAS Web Cache

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:

  1. Determine what documents you want to cache, how many are smaller than 4 KB and how many are larger than 4 KB. Determine the average size of the documents that are larger than 4 KB. Determine the expected peak load--the maximum number of documents to be processed concurrently.

    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.

  2. Calculate the amount of memory needed. The way you calculate it may differ depending on the version of Oracle9iAS Web Cache.

    The amount of memory that Oracle9iAS Web Cache uses to store a document depends on the document size:

    • If a document is smaller than 4 kilobytes (KB), Oracle9iAS Web Cache uses a buffer of 4 KB to store the HTTP body.

    • If a document is 4 KB or larger, Oracle9iAS Web Cache uses buffers of 32 KB to store the HTTP body. For example, if a document is 40 KB, Oracle9iAS Web Cache uses two 32 KB buffers to store the HTTP body.

    • Regardless of the size of the body, Oracle9iAS Web Cache uses 4 KB to store the HTTP response header.

    Use the following formula to determine an estimate of the maximum memory needed:

    ( X * ( 4KB + 4KB ) ) + ( Y * (( [m/32] * 32KB ) + 4KB )) + basemem 
    

    In the formula:

    • X is the number of documents smaller than 4 KB.

    • 4KB is the buffer size for the HTTP body for documents smaller than 4 KB.

    • 4KB is the buffer size for the HTTP response header.

    • Y is 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.

    • 32KB is the buffer size for the HTTP body for documents that are 4 KB or larger.

    • basemem is 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:

      60KB + (number of ESI fragments * [6KB to 25KB])
      

      For example, for a document with 10 ESI fragments, use the following calculation:

      60KB + (10 * [6KB to 25KB]) = 120KB to 330KB 
      

      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:

    (5000 * (4KB + 4KB) ) + ( 2000 * (( [54/32] * 32KB ) + 4KB )) + (500 *[6KB 
    to 25KB])
    

    Using the formula, you need:

    • 40,000 KB for the smaller documents.

    • 136,000 KB for the larger documents. For the HTTP body, you need 64 KB (two 32 KB buffers) for each document, given the average size of 54 KB. For the HTTP response header, you need 4 KB for each document.

    • 3,000 KB to 12,500 KB for the base amount of memory needed to process 500 concurrent requests.

    This results in an estimate of 179,000 KB to 188,500 KB of memory needed.


    Note:

    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.


  3. Configure Oracle9iAS Web Cache, specifying the result of the formula as the maximum cache size. Remember that the result is only an estimate.

    To specify the maximum cache size, take the following steps:

    1. In the navigator pane, select Cache-Specific Configuration > Resource Limits.

    2. On the Resource Limits page, select the cache and click Edit.

      The Edit Resource Limits dialog box appears.

    3. In the Maximum Cache Size field, enter the result of the formula.

    4. Click Submit.

    5. In the Oracle9iAS Web Cache Manager main window, click Apply Changes.

  4. Restart Oracle9iAS Web Cache.

  5. Using a simulated load or an actual load, monitor the cache to see how much memory it really uses in practice.

    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:

    • Size of Documents in Cache shows the current logical size of the cache. The logical size of the cache is the size of the valid documents in the cache. For example, if the cache contains two documents, one 3 KB and one 50 KB, the Size of Documents in Cache is 53 KB, the total of the two sizes.

    • Configured Maximum Cache Size indicates the maximum cache size as specified in the Resource Limits page.

    • Current Allocated Memory displays the physical size of the cache. The physical size of the cache is the amount of data memory allocated by Oracle9iAS Web Cache for cache storage and operation. This number is always smaller than the process size shown by operating system statistics because the Oracle9iAS Web Cache process, like any user process, consumes memory in other ways, such as instruction storage, stack data, thread, and library data.

    • Current Action Limit is 90% of the Configured Maximum Cache Size. This number is usually larger than the Current Allocated Memory.

    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.

Make Sure You Have Sufficient Network Bandwidth

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.

Set a Reasonable Number of Network Connections

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:

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 netstat -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:

  1. In the navigator pane of Oracle9iAS Web Cache Manager, select Cache-Specific Configuration > Resource Limits.

  2. On the Resource Limits page, select the cache and click Edit.

    The Edit Resource Limits dialog box appears.

  3. In the Maximum Incoming Connections field, enter the new value.

  4. Click Submit.

  5. In the Oracle9iAS Web Cache Manager main window, click Apply Changes.

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.

Connections on UNIX Platforms

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 webcachectl utility.

Oracle9iAS Web Cache uses the following formula to calculate the maximum number of file descriptors to be used:

Max_File_Desc = Curr_Max_Conn + Total_WS_Capacity + Outgoing_Cluster_Conn + 100

In the formula:

Connections on Windows NT and Windows 2000

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:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

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.


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index