Oracle Database Cache Concepts and Administration Guide Release 1.0.2.1 Part Number A88706-01 |
Library | Service | Contents | Index

# 1
Introducing Oracle Database Cache

Oracle Database Cache improves the scalability and performance of applications that access Oracle databases by caching frequently used data on a middle-tier system. With Oracle Database Cache, your applications can process several times as many requests as their original capacity. In addition, you do not need to modify your existing applications to use Oracle Database Cache. Oracle Database Cache is transparent to your end users.

## Who Should Use Oracle Database Cache?

If your applications meet the following criteria, you can use Oracle Database Cache to boost the scalability of your Web sites and the performance of your applications:

- Your applications access Oracle databases.

- You use a multiple-tier environment, where the clients, Web or application servers, and Oracle database servers are located on separate systems.

- Your applications communicate with an Oracle database through Oracle Call Interface (OCI), or an access layer built on OCI, like JDBC-OCI, ODBC, or OLE. The applications can be written using scripting or programming languages.

- Web or application users generate mostly read-only queries.

- Data residing in a subset of tables is more frequently accessed than other data in the database.

- Your applications can tolerate some synchronization delay with data in the origin database. That is, the data in the cache does not need to be as up-to-date as the data in the origin database. (You decide how often to refresh the data.)

Many applications meet these characteristics, including e-business and content publishing applications.

## What Are the Benefits of Oracle Database Cache?

Oracle Database Cache maintains a cache of frequently requested data on the middle tier (the Web server or application server tier), and it processes read-only requests using this dynamic cache.

Oracle Database Cache provides performance and scalability benefits by:

- Processing database queries on the middle tier, thereby reducing the time spent sending and receiving the data over the network. As a result, Web and application servers can process more queries faster using the same amount of hardware resources.

- Reducing the load on the database server tier by processing the most common read-only requests on the Web or application server tier. As a result, existing databases can support more users.

There is no need to modify your existing applications or your existing databases to achieve these benefits.

## What Is the Oracle Database Cache Environment?

In a traditional multiple-tier environment running Web applications, the client (typically a Web browser) displays HTML or XML sent by an application running on the middle tier (usually a Web or application server). The middle tier gathers the information from the database server and translates the information into an HTML or XML page that can be displayed by the client. The database server tier stores, searches for, and retrieves data. The following figure shows an example of this Web-based, traditional, multiple-tier environment:

Text description of the illustration trad_arch.gif

In this environment, each user executes a database request using a distinct path from the Web browser through the Web server to the database, even if more than one user is requesting the same information. For example, assume that your database contains information about books, such as the book title, author, description, and ranking in a best-seller list. If User A and User B both request the list of the top 10 mystery books, each user's request is routed through the application or Web server to the database on the database server. For each user, the database server returns the data through the application or Web server, which sends it to the Web browser for display. Each user receives a separate copy of the data. Later, if User A makes the same request, it is routed once again through the application or Web server to the database on the database server.

Other types of applications, such as content publishing, running in a multiple-tier environment, function in a similar way.

Using Oracle Database Cache, you can store frequently requested data on the Web or application server tier. The requests of User A and User B from the client tier are routed to the cache on the middle tier, which returns the data. The following figure shows the multiple-tier environment using Oracle Database Cache:

Text description of the illustration ic_arch.gif

In this environment, Oracle Database Cache software, consisting of a middle-tier cache for storing data and intelligent software to route queries, resides on each Web or application server on the middle tier. Frequently accessed data is stored in the middle-tier cache. The origin database (on the database tier) is the original and primary storage for the data. For this release, a middle-tier cache can cache data from only one origin database.

When users request the frequently accessed data, the requests pass from the client, such as a Web browser, to the Web or application server, which returns the data. For example, assume you cache information about books, such as the book title, author, description, and ranking in a best-seller list, in the middle-tier cache. If User A and User B both request the list of the top 10 mystery books, each user's request is routed to the middle-tier cache. Because the data is stored on the same tier, the application returns the data quickly and does not need to pass the request to the origin database server for retrieval of the data. Furthermore, each user can click on one of the titles to get more detailed information about the book. The query is routed to the middle-tier cache, which returns the data quickly.

## How Does Oracle Database Cache Work?

Oracle Database Cache provides a middle-tier cache for storing data and an easy-to-use management interface for managing the Oracle Database Cache environment. Oracle Database Cache caches and manages data in entities called data sets. A data set is any collection of data items that can be expressed using a SQL SELECT statement. A data set can be a table or any subset of a table, or data from more than one table.

Note: For this release of Oracle Database Cache, you must cache entire tables; you cannot cache just the parts of tables that satisfy the query. As a result, a data set must be an entire database table.

Oracle Database Cache also provides components that transparently route queries to the middle-tier cache, enforce data caching policies, and store statistics about cache hits and misses. A hit is a query that was satisfied in the middle-tier cache. A miss is a query that could not be satisfied in the cache and that was routed to the origin database. Oracle Database Cache provides transparent connectivity to the origin database.

You use a Java-based interface, Cache Manager (a component of DBA Studio), to set up and manage your Oracle Database Cache environment. When you set up a middle-tier cache, you specify the origin database, the data sets (or tables) to be cached, and cache properties, such as memory allocation, disk space, and the synchronization policy. The synchronization policy establishes how and how often the data in the cache is refreshed from the origin database.

The following figure illustrates the Oracle Database Cache environment in more detail:

Text description of the illustration ic_detail.gif

Oracle Database Cache maintains a history of queries and, based on that history, intelligently routes queries either to the middle-tier cache or to the origin database. It also maintains statistics about the queries. These statistics are accessed by all clients attached to a particular middle-tier cache.

When a user requests data, Oracle Database Cache checks to see if the query has been executed previously. If it has and if the history indicates that the data is not found in the middle-tier cache, Oracle Database Cache immediately routes the request to the origin database, which returns the data, through the Web or application server, to the user.

If the query has not been executed previously, Oracle Database Cache attempts to execute the query using the middle-tier cache. If the query can be satisfied on the middle-tier cache, Oracle Database Cache returns the data from the middle-tier cache to the user. (Note that a query may return no data, as when a user requests books by an author whose information is not stored in the database. In this case, the query is regarded as being satisfied by the cache.) If the query cannot be satisfied by the cache, Oracle Database Cache routes the request to the origin database, which returns the data, through the Web or application server, to the user. In either case, Oracle Database Cache records information about the query.

If the request is an insert, update, or delete, rather than a query, Oracle Database Cache immediately routes the request to the origin database.

If the request is a PL/SQL subprogram (procedure or function) or anonymous block or a call to a PL/SQL stored package, function, or procedure and if routing of PL/SQL is enabled, Oracle Database Cache attempts to execute the request. If Oracle Database Cache encounters an insert, update, or delete request, the request fails and Oracle Database Cache routes the request to the origin database.

Cache Manager helps you monitor the ratio of hits to misses. You can use this information to assess whether you are caching the appropriate data sets, you need to cache additional data sets, or you need to drop the currently cached data sets and cache different data sets.

## How Do Applications Use Oracle Database Cache?

You do not need to modify your applications to take advantage of the benefits of Oracle Database Cache. You only need to configure the environment of your applications, as described in "Configuring Your Application Environment". Applications that use SQL statements to access the database are routed to the middle-tier cache automatically. Similarly, applications that are linked with OCI using dynamic libraries and layered directly on OCI are routed to the middle-tier cache automatically. (Applications layered directly on OCI are those applications that call OCI directly or use ODBC, JDBC, or other interfaces that call OCI directly.)

Note that applications must use OCI in threaded mode. If they do not, refer to "Applications Must Be Linked in Multithreaded Mode" for information about linking in multithreaded mode.

Applications that are linked with OCI using static libraries and layered directly on OCI require that you relink those applications with the OCI library that ships with Oracle Database Cache. See "Linking Applications That Use Static OCI Libraries" for more information.

| Copyright © 2001 Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index