Oracle Web Cache for Oracle WebLogic Server

Web traffic can be very graphic-intensive. It can also be repetitive, displaying the same pages over and over again. Both of these characteristics could slow down Web traffic. A Web caching server (also known as a reverse proxy) can speed up this traffic.

Purpose

This tutorial covers how to configure the Web Cache portion of the Web Tier to support traffic for a particular application, in this case the WebLogic Server Administration Console.

Time to Complete

Approximately 1/2 hour

Overview

The WebLogic Server 11g comes with a built-in Web server which is adequate for displaying its own Web pages and could be used for applications hosted on the WebLogic servers. You could use a more industrial-strength Web server such as Oracle HTTP Server (OHS) from the Web Tier, but you don't have to. In this OBE, you are going to use the built-in Web server and front-end it with the Web Tier Web Cache to speed up Web pages. The application that will be cached is the Administration console, normally found on port 7001. That port will continue to work uncached, but users of the application will be instructed to use a different URL (same host, but port 7785) for future traffic so that it will be cached. So to access the uncached Administration Console, you would use http://yourhost:7001/console; and to access the cached Administration Console you would use http://yourhost:7785/console. Note that OHS is not involved at all (that is another OBE), this is using only the built-in WLS Web server.

Scenario

You want to make Web traffic to and from the Administration Console go faster and be more efficient by caching parts of the Web pages. If this works, then you may extend the caching to other applications.

Software and Hardware Requirements

This OBE requires a working Web Tier installation with Enterprise Manager 11g Fusion Middleware Control. In order to do that, the following list of software steps is required:

  1. Install WebLogic Server binaries, but do not run Quickstart, do not create a domain yet.
  2. Install SOA in the WebLogic middleware home in order to get the Java Required Files (JRF). Note: You don't actually use SOA in this OBE.
  3. Run <middleware_home>/<soa_directory>/common/bin/config.sh to create a WebLogic domain. Select Enterprise Manager (EM, which will auto-select JRF as well). Accept the defaults for most everything. Default names will be assumed throughout the OBE.
  4. Start the WebLogic server. You should now be able to log in to EM if you want to verify that EM is working properly.
  5. Run the Web Tier install. Select "Create a Web Tier instance" and "Associate it with your WLS."
  6. Log in to EM. You should see OHS (Oracle HTTP Server) and Web Cache as targets on the Farm home page in EM.

Prerequisites

Before starting this tutorial, you should:

.

Complete "Installing and Configuring Oracle Web Tier" OBE or equivalent.

.

Install (deploy) the sample application WebAppWar (or equivalent) that was included with OBE titled "Configuring Oracle Web Cache for Caching a Java EE Application"

Verification of Environment Before Configuring

It would be helpful to see exactly what the behavior of the applications is before making any changes so that you can be convinced that you are seeing the Web Cache affecting the performance. To verify the default behavior, perform the following steps:

Verify the Enterprise Management Farm

Verify that the Enterprise Manager 11g Fusion Middleware Control is running properly and that all the elements of the Farm are started.

.

In a Web browser, go to URL http://yourhost:7001/em/ and log in. The 7001 is the default Administration Server port number, your port may be different.

Expand all the items on the left by clicking on the plus [+] icons and verify that all the Status arrows are green and that all of the pie chart slices are green (up and running). Your host names and IP addresses will be different.

 

Verify Web Cache

Verify that the Web Cache is operational even though it is not currently configured to do anything.

.

On the left, navigate to Farm_base_domain > Web Tier > webcache1.

Most of the Performance values should be zero. It is possible for a few values to be single digits. There should be no Origin Servers defined in the lower right box.

 

Verify Deployed User Application

The user application should be deployed and running. It is not important what the application does, just that it is on the same port as the Administration Console and yet is on a different context root.

.

In a Web browser, go to URL http://yourhost:7001/cntroot/login.jsp but do not login. Just verify that some page loads.

So there are several applications running on port 7001: the Enterprise Manager in context /em, the Administration Console in context /console, the user application on /cntroot/login.jsp, and Welcome on the default (no path). You can check them all out if you wish.

 

Verify WLS Administration Console

Actually you are verifying the NON-function of the WebLogic Server Administration Console on port 7785. Port 7785 is the default listen port for the Web Cache, and by default it will send anything it hears on that port to the Oracle HTTP Server (OHS) on port 7777, which at the moment is not configured to do anything. So a specific request for /console should not be serviced since there is no application by that name on the OHS server.

.

In a Web browser, go to URL http://yourhost:7785/console. It should fail.

Port 7785 is active, just not for anything named /console.

 

Configuring Web Cache

The goal is to put the Web Cache in between the user's browser and the WebLogic Server. While you could use this for anything going to port 7001, to make it more interesting you will configure the Web Cache to only cache the pages for the Administration Console, that is, :7001/console/*. There are two required steps: making an Origin Server and a Site mapping; there are many optional steps such as filter and expiration rules. To configure the Web Cache, perform the following steps:

Configuring Origin Server

This is the first of two required steps, the Origin Server. You could have several origin servers, such as your WLS application servers. The system comes preconfigured for a few servers already, for example the OHS server.

.

From the webcache1 Home page, navigate to Web Cache > Administration > Origin Servers.

There are several ways to get to this panel. A very different alternative is to start the Web Cache Manager (independent of the Enterprise Manager) from URL http://yourhost:7786/webcacheadmin and sign on with a userid of Administrator. That would accomplish the same final result, but using a different interface. You can verify that 7786 is the Web Cache admin port by running ./opmnctl status -l (the option is a lowercase letter L, not a number one) in a terminal session and looking for the admin port. For purposes of this OBE, you should use the Enterprise Manager as shown in the following steps.

 

.

Create a new Origin Server for the WebLogic Server application server. Click Create...

The existing two servers are for the Oracle HTTP Server (OHS) SSL and non-SSL.

 

.

Fill in Host with the Administration Server's fully-qualified name, for example yourhostname. Enter 7001 in Port.

The other defaults are fine. Click OK.

 

.

You should see the new Origin Server you just added.

This will not take effect until after a restart of the Web Cache server. Do not restart at this time.

 

Configuring Sites

This is the second of the two required steps. The goal is to make a map so that a request for URL thishost:portA gets mapped to URL thathost:portB, where thishost:portA is on the Web Cache server and thathost:portB is on an application server. This OBE example is a little bit harder to follow since the Web Cache thishost and the application server thathost are on the same computer. That is not required, and in fact may not even be desirable. If they are on the same computer, then portA and portB must be different.

.

Navigate to Web Cache > Administration > Sites.

The Web Cache restart is still pending, you will get to it after this step.

 

.

Create a new Site-to-Server Mapping.

Click the lower Create...

 

.

Enter the following information:

  • Host Pattern: yourhostname, for example, edrsr28p1.us.oracle.com
  • Port Pattern: 7785, which is the default listen port for the Web Cache. You could define other ports.
  • Prefix: /console. While you could make the entire application server cache all pages, just to illustrate the fine-grained nature, you are only going to cache the console application. You could add more matching patterns using regular expressions.

Select the server with the 7001 port, then click on the > Move icon.

yap

 

.

Verify that the server moved from the All Origin Servers to the Selected Origin Servers column.

Click OK.

 

.

Verify that the new mapping is at the top of the list. Unfortunately, the list does not show the prefix. The later mappings do not have prefixes. After the first match, the Web Cache stops looking in the list.

The order is important. Note that there are at least three other later maps that match yourhostname:7785/console, and they all would send the request to the "wrong" application server. Those maps send to the OHS, not the WLS server.

 

Restarting the Server

After each major configuration change, the system warned that a restart was needed in order for the changes to take effect.

.

Navigate to Web Cache > Control > Restart...

There are other OPMN ways to do the restart.

 

.

Click Restart.

 

.

There is nothing to do on this panel.

 

.

Click Close to dismiss the message.

The Web Cache service has been restarted and now the changes have taken effect.

 

Testing the Caching

This will be the same URLs that you tried in the first part of the OBE, except now they should work. To test the Web Cache, perform the following steps:

Testing Administrative Console

This failed earlier. It should work now. Note that you can get to the Administration Console two ways: the "normal" way of yourhost:7001/console should still work, but the "new" way of yourhost:7785/console should be faster since it caches many of the repeating elements (pages, icons, graphics, and so on.)

.

In a Web browser, go to URL http://yourhost:7785/console. It should work. Explore around inside the Administration Console for a minute or so to cause a caching of a good number of items.

Note the prefix of /console also satisfies /console/console.portal, and anything else after the prefix. A wildcard (asterisk, pattern, and so on) is not needed, it is assumed.

 

Testing User Application

This worked before on port 7001 and should still work as before.

.

In a Web browser, go to URL http://yourhost:7001/cntroot/login.jsp but do not login.

The Web Cache configuration did not negatively affect the other applications.

 

.

In a Web browser, go to URL http://yourhost:7785/cntroot/login.jsp. It should fail.

Even though some applications (for example, the console) are cached from port 7785, not all are redirected. They could be, but you chose not to. The Web Cache configuration did not positively affect the other applications.

 

Statistics and Reporting

Quantitatively, how much is the caching helping? There are many tools in the Enterprise Manager to measure and report the benefits you will get for this cached application now. To do report the statistics on caching, perform the following steps:

Popular Requests

The specific benefits depend on the usage patterns of the users. Also the cached items age and expire over time. Because of this, your graphs will be different each time you look.

.

Navigate to Web Cache > Monitoring > Popular Requests.

You have to do this fairly soon after the previous step since the items will age out. The age time is configurable, but the defaults are on the order of 60 to 3600 seconds.

 

.

You can look at different kinds of requests.

There are default rules that indicate which items are cached and which items are compressed. The defaults are fine, and you can change them on a site-by-site basis. By your configuration, all of the prefixes start with /console. So the Administration Console access is being cached, but the Enterprise Manager (prefix /em) is not. You can change that.

 

Graph Reports

Go to Web Cache > Home.

.

Note that when you first looked at these values, they were mostly zero. Most of the caching is from hostname:7785 mapped to hostname:7001/console.

In just a few minutes, the compressor saved about 2 MB of traffic in 195 requests. Your savings will vary.

 

Summary

You have used the Web Tier Web Cache to make the access of an application (in this case the WebLogic Server Administration Console, or any application you choose) to be more efficient.

In this tutorial, you have learned how to:

Resources

Credits (Optional)