Вы находитесь на странице: 1из 21

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 1 of 21

Configuring Oracle Web Cache for Session Binding and Load Balancing

Purpose

This tutorial describes how to configure Oracle Web Cache for session binding and load balancing.

Time to Complete

Approximately 30 minutes.

Overview

Oracle Web Cache can distribute load among multiple origin servers via HTTP or HTTPS. For applications that use sessions, Oracle Web Cache performs session binding to the origin servers as well.

Software and Hardware Requirements (Optional)

The following is a list of software requirements: Item Specification Processor Type Intel Xeon or
The following is a list of software requirements:
Item
Specification
Processor Type
Intel Xeon or Pentium IV
Processor Speed
2.4 GHz or higher
Number of Processors
1 or more (if required)
Memory
2 GB
Hard Disk Space
20 GB (initial size)
Operating System
RedHat Enterprise Linux 4 Update 5

Prerequisites

Before starting this tutorial, you should:

1 . Have an instance of Oracle WebLogic Server 10.3

2 . Have configured a domain

3 . Have completed the OBE titled "Configuring Oracle Web Cache for Caching a JavaEE Application"

Defining a Second Origin Server

Recollect that one of the prerequisites for performing Web Cache OBEs is that you should have two instances of 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 Oracle Web Cache for Caching a JavaEE Application." The default origin server for instance 1 is localhost 7780. The default origin server for instance 2 will be localhost 7781 because the instances are on the same machine. In this section you will define the two origin servers and map Oracle Web Cache with the origin servers for load balancing.

1 . Using the createcomponent command, create a WebCache component within your Oracle instance.

opmnctl createcomponent -componentName WC1 -componentType WebCache

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 2 of 21

for Session Bindin g and Load Balancin g Page 2 of 21 2 . Using the

2 . Using the createcomponent command, create a couple of Oracle HTTP Server components within your Oracle instance.

opmnctl createcomponent -componentName OR1 -componentType OHS

opmnctl createcomponent -componentName OR2 -componentType OHS

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 3 of 21

for Session Bindin g and Load Balancin g Page 3 of 21 Specify Site Definitions After

Specify Site Definitions

After you specify site definitions, you create ordered mappings of sites to origin servers. If you configured multiple origin servers for load balancing, then create one site-to-server mapping that maps all the applicable origin servers to the site. In that site-to-server mapping, select all the origin servers that apply for the site. If you split the origin servers among multiple site-to-server mappings, load balancing for the site does not occur in the intended manner.

1 . Enter the following URL to display Fusion Middleware Control.

http://<hostname>.<domain>:<port>/em

Enter the Oracle Fusion Middleware administrator User name and password. Click Login.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 4 of 21

for Session Bindin g and Load Balancin g Page 4 of 21 2 . Navigate to

2 . Navigate to the Web Cache Home page in Fusion Middleware Control. Select the Web Cache component, WC1. From the Web Cache menu, select Administration > Origin Servers.

Cache menu, select Administration > Origin Servers . http ://st-curriculum.oracle.com/obe/fmw/web _ cache/11 g

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 5 of 21

3 . If Oracle HTTP Server was installed, the installation process creates a default site-to-server
3 . If Oracle HTTP Server was installed, the installation process creates a default
site-to-server mapping based on the host name and listening port of Oracle HTTP
Server.
Verify that two origin servers are listed:
Host
localhost
Port
7780 and 7781 (the first and second origin server)
Protocol
HTTP
7781 (the first and second origin server) Protocol HTTP 4 . Next, create a site-to-server mapping

4 . Next, create a site-to-server mapping that maps all the applicable origin servers to the site. In that site-to-server mapping, select all the origin servers that apply for the site.

From the Web Cache menu, select Administration > Sites.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 6 of 21

for Session Bindin g and Load Balancin g Page 6 of 21 Oracle Web Cache resolves

Oracle Web Cache resolves an incoming request first to a site definition, and then to the first matching site-to-origin server mapping.

5 . The Sites page is displayed. Observe that you have a default site, for example, EDRSR15P1:7779. From the Site-to- Server Mapping section, click Create.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 7 of 21

for Session Bindin g and Load Balancin g Page 7 of 21 6 . Enter the
6 . Enter the following details to configure the Host Pattern, Port Pattern, and Prefix
6 . Enter the following details to configure the Host Pattern, Port Pattern, and Prefix elements:
Element
Value
Host Pattern
Enter the site pattern, such as www.company.com.
Port Pattern
Enter the HTTP or HTTPS port number for the Web site from which Oracle Web
Cache is listening for incoming requests.

Select the two origin servers from the Origin Servers section. Click OK.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 8 of 21

for Session Bindin g and Load Balancin g Page 8 of 21 7 . Click Apply

7 . Click Apply.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 9 of 21

for Session Bindin g and Load Balancin g Page 9 of 21 8 . Click Web

8 . Click Web Cache > Control > Restart to restart Oracle Web Cache.

> Control > Restart to restart Oracle Web Cache. Click Restart to confirm. http

Click Restart to confirm.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 10 of 21

for Session Bindin g and Load Balancin g Pag e 10 of 21 Click Close when

Click Close when the restart operation completes successfully.

Close when the restart operatio n completes successfully. Defining a Ping URL for Application De tection

Defining a Ping URL for Application Detection and Origin Server Capacity

Oracle 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 Oracle 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 . From the Web Cache menu, select Administration > Origin Servers.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 11 of 21

for Session Bindin g and Load Balancin g Pag e 11 of 21 2 . Select

2 . Select one of the Origin Servers and click Edit.

21 2 . Select one of the Origin Servers and click Edit . 3 . In

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

.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 12 of 21

for Session Bindin g and Load Balancin g Pag e 12 of 21 4 . For

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 Oracle Web Cache can establish with a particular origin server, change the Capacity to 50. Click OK.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 13 of 21

for Session Bindin g and Load Balancin g Pag e 13 of 21 5 . Repeat

5 . Repeat steps 2 through 4 for the other origin server (localhost:7781). Restart Web Cache.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 14 of 21

for Session Bindin g and Load Balancin g Pag e 14 of 21 Click Restart when

Click Restart when prompted for confirmation. Click Close to close the Confirmation window.

Configuring Oracle Web Cache to Use Cookie-Based Sessions

Oracle Web Cache offers three options for session binding mechanism: Cookie-Based, Session Binding IAS, and Internal-Tracking. The cookie-based session binding mechanism is applicable for all types of Web applications. Oracle 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 Session Binding IAS mechanism is used if the application you are trying to cache is based on OC4J. Oracle 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, Oracle 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 Oracle Web Cache Home page. From the Web Cache menu, select Administration > Session Configuration.

.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 15 of 21

for Session Bindin g and Load Balancin g Pag e 15 of 21 2 . The

2 . The Session Configuration page appears. From the Site list, select the site (for example: EDRSR15P1:7779) to create customized session-bindings.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 16 of 21

for Session Bindin g and Load Balancin g Pag e 16 of 21 Click Change the

Click Change the Site to confirm the selection.

e 16 of 21 Click Change the Site to confirm the selection. 3 . Scroll down

3 . Scroll down to Session Binding Configuration section. Select Cookie based session binding with any Set- Cookie. Click Apply.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 17 of 21

for Session Bindin g and Load Balancin g Pag e 17 of 21 4 . Restart

4 . Restart Oracle Web Cache from Web cache menu > Control > Restart.

Cache from Web cache menu > Control > Restart . Click Restart when prompted for confirmation.

Click Restart when prompted for confirmation. Click Close to close the Confirmation window.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 18 of 21

Confirming the Configuration for Session Binding

1 . Open a browser window and browse the application at http://localhost:7779/benefits. Oracle Web Cache serves the cached pages and forwards any requests to the origin servers.

.

.

pages and forwards any requests to the origin servers. . . 2 . Switch back to

2 . Switch back to the Application Server Control Console browser window. Navigate to Web Cache home page.

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 19 of 21

for Session Bindin g and Load Balancin g Pag e 19 of 21 3 . In

3 . In the Origin Servers region, observe that most of the requests are going to only one of the origin servers. Session binding is working correctly.

of the origin servers. Session binding is working correctly. http ://st-curriculum.oracle.com/obe/fmw/web _ cache/11 g

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 20 of 21

4 . Restart Oracle Web Cache from Web cache menu > Control > Restart.

Web Cache from Web cache menu > Control > Restart. Click Restart when prompted for confirmation.

Click Restart when prompted for confirmation. Click Close to close the Confirmation window.

Summary

In this tutorial, you have learned how to:

Define a ping URL for the application to detect its availability Configure Oracle Web Cache to use cookie-based sessions

Resources

Oracle Fusion Middleware Guide Administrator's Guide for Oracle Web Cache 11g Release 1 (11.1.1) Configuring and Managing Oracle Web Cache eStudy To learn more about , refer to additional OBEs on the OTN Web site (can link to a specific set of OBEs on the subject)

site (can link to a specific set of OBEs on the subject) User Comments Title: n
site (can link to a specific set of OBEs on the subject) User Comments Title: n

User Comments

Title:

a specific set of OBEs on the subject) User Comments Title: n m l k j

nmlkji Post as ashish.baisyet@nepasoft.com.np nmlkj Post anonymously

Configuring Oracle Web Cache for Session Binding and Load Balancing

Page 21 of 21

By submitting a comment, you confirm that you have read and agreed to the terms

By submitting a comment, you confirm that you have read and agreed to the terms and conditions.

If you have general questions about this Oracle software product, consult the OTN forums instead.

If you are encountering a software problem and need to request support or consulting, Oracle Support. If you want to order hardcopy documentation, go to the Oracle Store.

Submit a new comment

(Comments are moderated and will not appear immediately.)

go to the Oracle Store . Submit a new comment (Comments are moderated and will not

This feedback form is for tutorial corrections and suggestions. Because of the volume of suggestions, we cannot reply to every comment. In particular:

file a service request on My

http://st-curriculum.oracle.com/obe/fmw/web_cache/11g/r1/session_bind/session_bind.ht

11/3/2010