Configuring OracleAS Web Cache for Session Binding and Load Balancing
Configuring OracleAS Web Cache for Session Binding and
Load Balancing
This tutorial describes how to configure OracleAS Web Cache
for sesison binding and load balancing.
Approximately 20 minutes
This tutorial covers the following topics:
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.
Back to Topic List
|
OracleAS Web Cache can distribute load among multiple
origin servers via HTTP or HTTPS. For applications that use sessions,
OracleAS Web Cache performs session binding to the origin servers as well.
|
Back to Topic List
Before starting this tutorial, you should:
| 1. |
Have completed the OBE titled
"Configuring OracleAS Web Cache for Caching a J2EE Application" |
Back to Topic List
|
Recollect that one of the prerequisites for performing
Web Cache OBEs is that you should have two instances of Application Server
Mid Tier (J2EE and Web Cache). For these OBEs, we have installed both
the instances on the same machine. You have worked on the first instance
in the first OBE titled "Configuring OracleAS Web Cache for Caching
a J2EE Application." The default origin server for instance 1 is
localhost 7778. The default origin server for instance 2 will be
localhost 7779 because the instances are on the same machine. In
this section you will define a second origin server localhost 7779
and map OracleAS Web Cache with the origin servers for load balancing.
|
| 1. |
From the Oracle Enterprise Manager 10g Application Server Control
Console, go to the OracleAS Web Cache Home page. Click the Administration
tab.
Click Origin Servers under Properties.

|
| 2. |
Click Create to create the second origin server.

|
| 3. |
Enter the following parameter values in their respective fields:
Host: localhost
Port: 7779
Capacity: 100
Routing: Enabled
Failover Threshold: 5
Ping URL: /
Ping Frequency: 10
Leave all other parameters as default and click OK.

|
| 4. |
Click Restart Web Cache to restart Web Cache.

Click Yes when prompted for confirmation.


|
| 5. |
Click Sites.

Under Named Sites Definitions, select localhost:7777 and click
Edit.

|
| 6. |
A new origin server should appear under the Available Origin Servers
column. Select that origin server and move it to the Selected Origin Servers
column.

Click OK.

|
| 7. |
Click Restart Web Cache to restart Web Cache.

Click Yes when prompted for confirmation.


|
Back to Topic List
|
OracleAS Web Cache detects the availability of the application
by sending a user-defined URL to the origin server periodically. If there
is no response, then OracleAS Web Cache assumes that the origin server
is unavailable. The fact that the origin server fails to respond can also
mean that there is a problem with the application. Therefore, the Ping
URL serves for application detection as well.
|
| 1. |
Click Web Cache in
the breadcrumbs to return to the OracleAS Web Cache Home page.

Click Administration
tab and then click Origin Servers under Properties.

|
| 2. |
Select one of the origin servers and click Edit.

|
| 3. |
In the Ping URL field, enter /hrapp. /hrapp is a redirect header
with zero byte size from the origin server. Because /hrapp does not require
much resources from the origin server, it is an ideal candidate for ping
URL.

|
| 4. |
For the purpose of this OBE, the load at origin server is expected to
be low. To lower the number of maximum concurrent connections that OracleAS
Web Cache can establish with a particular origin server, change the Capacity
to 50. Click OK.

|
| 5. |
Repeat steps 2 through 4 for the other origin server (localhost:7779).
Click Restart Web Cache to restart Web Cache.

Click Yes when prompted for confirmation.


|
Back to Topic List
|
In Oracle Application Server 10g Release 2, OracleAS
Web Cache offers three options for session binding mechanism: Cookie-Based,
OC4J-Based, and Internal Tracking.
The cookie-based session binding mechanism is applicable for all types
of Web applications. OracleAS Web Cache generates its own cookie to perform
session stickiness to the origin servers, so the session stickiness still
persists even if the application changes its session ID.
The OC4J-based mechanism is used if the application you are trying to
cache is based on OC4J. OracleAS Web Cache forwards routing information
with each request to OC4J through Oracle HTTP Server.
The Internal Tracking mechanism is used if the application does not support
cookies or is not OC4J-based. In this case, OracleAS Web Cache maintains
an in-memory routing table.
In this section, you will configure Web Cache to use cookie-based sessions.
|
| 1. |
Navigate to the OracleAS Web Cache Home page.
Click the Adminsitration tab and then click Sites under
Properties.

|
| 2. |
Under Named Site Definitions, select the site, localhost:7777
and click Edit.

|
| 3. |
Click the Advanced tab to go to advanced section.

|
| 4. |
Under Session Binding, make sure that Enable session binding for this
site is selected. Select Any Set Cookies from the Session
drop-down list and select Cookie-Based from the Session Binding
Mechanism drop-down list. Click OK.

|
| 5. |
Click Restart Web Cache to restart Web Cache.

Click Yes when prompted for confirmation.


|
Back to Topic List
| 1. |
Open a browser window and browse the application at http://localhost:7777/hrapp.
OracleAS Web Cache serves the cached pages and forwards any requests
to the origin servers.
|
| 2. |
Switch back to the Application Server Control Console browser window.
Navigate to OracleAS Web Cache Home page. Go
to Performance tab and click Origin Servers.

|
| 3. |
Click the link for the first origin server.

Check Total Requests under Request Throughput.

|
| 4. |
Click the Back button on your browser and click the link for the second
origin server.

Check Total Requests under Request Throughput.

Note that most of the requests are going to only one of the origin servers.
Session binding is working correctly.
|
Back to Topic List
|
For J2EE applications, OracleAS Web Cache can use JSESSIONID
for session binding. You will have to change the setting for session binding.
|
| 1. |
Navigate back to the OracleAS Web Cache
Home page and click the Administration tab. Click Sites
under Properties.

Select the site localhost:7777 and click Edit.

|
| 2. |
Click the Advanced tab to go to the advanced section.

Under Session Binding, make sure that Enable session binding for this
site is selected. Select JSESSIONID from the Session
drop-down menu and select OC4J-Based from the Session Binding Mechanism
drop-down menu. Click OK.

|
| 3. |
Click Restart Web Cache to restart Web Cache.

Click Yes when prompted for confirmation.


|
| 4. |
Switch to the browser window that you used to browse the application.
Browse the pages again at http://localhost:7777/hrapp.
|
| 5. |
Switch back to the Application Server Control Console browser window
and verify whether most of the requests are going to one of the origin
servers. To verify, follow steps 2 through 4 of the topic titled "Confirming
the Configuration for Session Binding."


|
Back to Topic List
In this lesson, you have learned how
to:
|
Define a ping URL for the application to detect
its availability
|
|
Configure OracleAS Web Cache to use cookie-based sessions and JSESSIONID
|
 |
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.
|