Legal | Privacy
Configuring OracleAS Web Cache for Caching a J2EE Application

Configuring OracleAS Web Cache for Caching a J2EE Application

This tutorial describes how to cache a Web application.

Approximately 30 minutes

This tutorial covers the following topics:

Overview
Prerequisites
Adding Caching Rules and Compression
Summary
Related Information

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

Oracle Application Server Web Cache (OracleAS Web Cache) is a content acceleration and assembly solution designed to scale the middle-tier infrastructure and improve end-user experience. By caching the frequently requested Web content in memory, OracleAS Web Cache effectively offloads application servers and database from repeatedly processing those requests. The picture below shows a typical deployment scenario of OracleAS Web Cache running in a cluster mode.

 

 

With OracleAS Web Cache, you can cache personalized Web pages that you otherwise cannot cache by using legacy caching products. You can even cache parts of a page as fragments by using the Edge Side Includes (ESI)* specification. OracleAS Web Cache provides a flexible invalidation mechanism to ensure consistency in content between the origin servers and the cache. To scale and increase availability of your Web sites, you can configure OracleAS Web Cache to perform back-end load balancing, fail over, and native clustering. OracleAS Web Cache also supports GZIP for compressing content (both cached and noncached content) and secure sockets layer (SSL) for handling encrypted content. With OracleAS Web Cache, Web sites can now serve content faster and to more customers by using fewer computing resources than ever before.

The benefits of OracleAS Web Cache can be measured by improvements in the following areas:

Performance: Better throughput and scalability
User experience: Faster response time without sacrificing personalization
Availability: Through surge protection, clustering, load balancing, and failover
Developer productivity: No need to roll your own cache means faster time-to-market
Bottom line: Reduced load on application and database servers translates into infrastructure cost savings

* ESI is a simple markup language used to define components of a Web page for dynamic assembly and delivery of Web applications at the edge of the Internet. More information about ESI is available at http://otn.oracle.com/products/ias/web_cache.

 

Prerequisites

Before starting this tutorial, you should:

1. Have two instances of Application Server 10g Mid Tier (J2EE and Web Cache). For these OBEs, it is assumed that both the instances are installed on the same machine.
2. Have installed Oracle Database 10g. Make sure that you have hr schema.
2.

Download and unzip the hrapp.zip file on your machine. Deploy the hrapp.ear file to the Oracle Application Server.


 

If you want to cache your document by using OracleAS Web Cache, then you must establish a caching policy. The caching policy can be embedded within the application specified by the application developers (for example, using Edge Side Includes tags [www.esi.org] or surrogate-control headers) or explicitly set as a caching rule in Oracle Enterprise Manager 10g Application Server Control Console.

 

1.

Open a browser window, and enter the following URL to access the application:
http://localhost:7777/hrapp

Enter the following username and password to login:

Username: Guest (case sensitive)
Password: welcome (case sensitive)

Move your mouse over this icon to see the image

Click the links and browse through the application to generate some data for the Popular Requests page.

You can check whether the pages are cached or not by visiting the Popular Requests page.

 

2.

In the browser, change the URL to http://localhost:1810/.

Note: 1810 is the default port that is automatically assigned while installing the Oracle Application Server. However, if another instance is already running on 1810, then the next port may be assigned during installation.

Log in as ias_admin/<admin password you specified during install>,
and click OK.

Move your mouse over this icon to see the image

 

3.

You are accessing the Oracle Enterprise Manager 10g Application Server Control Console. You see the Application Server Home page, which provides a high-level overview of your application server (including status, system resource usage, and enabled and configured components).

Move your mouse over this icon to see the image

 

4.

In the System Components table, click the Web Cache link to navigate to the OracleAS Web Cache Home page.

Move your mouse over this icon to see the image

 

5.

Click the Performance tab, and then click Popular Requests.

Move your mouse over this icon to see the image

 

6.

You see Not Cached in the Cached column.

Move your mouse over this icon to see the image

 

7.

Click Web Cache in the breadcrumbs to go back to the Web Cache Home page. Click the Administration tab.

Move your mouse over this icon to see the image

 

Click the Rules link under Properties.

 

Move your mouse over this icon to see the image

 

8.

On the Rules page, click Create to create a rule.

Move your mouse over this icon to see the image

Enter values or select from the drop-down list to match the values given below:

Name: Any name that you want
Description: Any description that you want
Site: localhost:7777
Match URL By: File Extension jsp


Move your mouse over this icon to see the image

 

9.

Expand Show HTTP Methods and Parameters.
Under HTTP Methods, select the GET and GET with query string check boxes.

Move your mouse over this icon to see the image

 

Under Caching, select Cache and select Expires: Max Time in Cache, 5 Minutes, Refresh: Immediately from the Expiration of Cached Response drop-down list.

 

Move your mouse over this icon to see the image

 

Under Compression, select Compress for all browsers. Leave other parameters as default values. Click OK.

 

Move your mouse over this icon to see the image

OracleAS Web Cache uses regular expression to represent the URL. In this example, you are instructing OracleAS Web Cache to cache all JavaServer Pages (JSP). If you want to cache a specific page, you simply enter the URL of the page and select URL Expression as the Expression Type.

By enabling compression, you are instructing OracleAS Web Cache to compress the pages by using GZIP. OracleAS Web Cache sends compressed content according to the accept-encoding field in the client request. If the client browser does not support GZIP, OracleAS Web Cache sends the content uncompressed.

You are setting the cached documents to expire every 300 seconds (5 minutes). You learn how to manually invalidate a certain document (regardless of whether you have set up an expiration policy or not) later in this tutorial.

 

10.

The new caching rules should appear in the Rules table. You have completed the basic configuration of OracleAS Web Cache. Click Restart Web Cache to restart the Web Cache.

Move your mouse over this icon to see the image

 

Click Yes when prompted for confirmation.

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

 

 

OracleAS Web Cache is transparent to the end user. Instead of going to the listen port of the application server, the client sends requests to the listen port for OracleAS Web Cache.

 

1.

Open a new browser window, and enter the following URL:
http://localhost:7777/hrapp

Enter the following username and password to login:

Username: Guest (case sensitive)
Password: welcome (case sensitive)

Place the cursor over this icon to see the image

In this tutorial, OracleAS Web Cache is configured to listen on port 7777 for HTTP requests and OracleAS HTTP Server (OHS) is configured to listen on port 7778. When you access the application through OracleAS Web Cache, you should see the same page that you see when you access it through OHS directly. You do not see any difference because OracleAS Web Cache is transparent to the end user.

 

2.

Click the links on the Web site. When you first request the page, OracleAS Web Cache forwards the request back to the origin server and then caches the response from the origin server. The next time you request the same page, OracleAS Web Cache serves it from its cache.

Place the cursor over this icon to see the image

 

 

 

1.

Check Popular Requests again. Go back to the browser window that is displaying the Rules page. Click Web Cache in the breadcrumbs.

Move your mouse over this icon to see the image

 

Click the Performance tab, and then click Popular Requests.

 

Move your mouse over this icon to see the image

 

2.

The Popular Requests page displays the most popular requests received by OracleAS Web Cache, regardless of the caching of the pages. Notice that the JSP pages are cached and compressed. You may need to click Refresh to refresh the page.

Place the cursor over this icon to see the image

Notice that /localhost:7777/hrapp and /localhost:7777/hrapp/ are not cached. To learn how to cache these requests, see the OBE titled "Optimizing OracleAS Web Cache."

 

 

 

1.

Navigate back to the Web Cache Home page, and click the Administration tab.

Move your mouse over this icon to see the image

 

Click the Invalidation link under Operations.

 

Move your mouse over this icon to see the image

 

2.

Check that the All Objects option is selected, and click Next.

Place the cursor over this icon to see the image

OracleAS Web Cache offers flexible invalidation mechanisms. One method is to specify the exact object (or objects) for precise invalidation. Besides Oracle Enterprise Manager interface, OracleAS Web Cache accepts XML-based invalidation messages at its invalidation port. Telnet or database triggers can be used to generate the invalidation messages.

 

3.

Check that the Remove objects immediately option is selected, and click Next. If you select the second option, OracleAS Web Cache gets a grace period to serve the stale content after invalidation. This minimizes overloading the origin servers, which results from content refresh on a big scale. This function is useful for the content that is less critical.

Place the cursor over this icon to see the image

 

4.

Click Finish.

Place the cursor over this icon to see the image

 

You see Invalidation Result. Click OK.

 

Place the cursor over this icon to see the image

 

5.

Check the Popular Requests page again. Click the Performance tab, and then click Popular Requests. All the cached entries are removed from the Popular Requests table.

Place the cursor over this icon to see the image

 

In this lesson, you have learned how to:

Add caching rules

Access Web pages through OracleAS Web Cache
Verify cached content and invalidate the content

Related Information

To ask a question about this OBE tutorial, post a query on the OBE Discussion Forum.
To learn more about OracleAS Web Cache, click here.

Place the cursor over this icon to hide all screenshots.

Copyright © 2004 Oracle Corporation. All Rights Reserved.

 

 

 

 

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy