セッション・バインディングおよびロード・バランシングを行う ためのOracleAS Web Cacheの構成

このチュートリアルでは、セッション・バインディングおよびロード・バラ ンシングを行うためにOracleAS Web Cacheを構成する方法について説明します。

約20分

このチュートリアルの内容は次のとおりです。

概要
前提 条件
2つ目のオリジナル・サーバーの定義
アプリケーション検出のためのPing URLおよびオリジナル・サーバーの容量の定義
まと め
関連 情報

このアイコ ンの上にカーソルを置くと、このチュートリアルのすべてのスクリーンショットが表示されます。 (注意: この操作によりすべてのスクリーンショットが同時に読み込まれるため、使用しているインターネット接続の種類によっては応答が遅い場合があります。)

注意: 各手順に関連するスクリーンショットのみを表示する場合は、それぞれの手順のアイコンの上にカーソルを置いてくださ い。


OracleAS Web Cacheでは、HTTPまたはHTTPSを使用して負荷を複数のオリジナル・サーバーに分散できます。 セッションを使用するアプリケーションの場合、OracleAS Web Cacheは、オリジナル・サーバーに対してもセッション・バインディングを実行します。

前提条件

このチュートリアルを始める前に、次のことを実行しておく必要がありま す。

1. 「J2EE アプリケーションをキャッシュするためのOracleAS Web Cacheの構成」のチュートリアルの完了

Web Cache OBEの前提条件の1つは、Application Server中間層の2つのインスタンスであるJ2EEおよびWeb Cacheが実装されていることです。 このOBEシリーズでは、この2つのインスタンスを同一マシン上にインストールしました。 J2EEは、「J2EEアプリケーションをキャッシュするためのOracleAS Web Cacheの構成」というタイトルのOBEで扱いました。 インスタンス1のデフォルトのオリジナル・サーバーは、localhost 7778です。 2つのインスタンスは同一マシン上に存在するため、インスタンス2のデフォルトのオリジナル・サーバーは、localhost 7779に なります。 この項では、2つ目のオリジナル・サーバーlocalhost 7779を定義し、ロード・バランシングに対応するためにオリ ジナル・サーバーを使用してOracleAS Web Cacheをマップします。


1.

Oracle Enterprise Manager 10g Application Server Control Consoleから「OracleAS Web Cache Home」ページに進みます。 「Administration」 タブをクリックします。

このアイコンの上にカーソルを置くと、スクリーンショットが表示されます
                        

Properties」の下の「Origin Servers」 をクリックします。

 

Move your mouse over this icon to see the image

 

2.

Create」をクリックして、2つ目のオリジナル・サーバーを作成します。

Move your mouse over this icon to see the image

 

3.

関連するフィールドに、次のパラメータ値を入力します。

Host: localhost
Port: 7779
Capacity: 100
Routing:有効
Failover Threshold: 5
Ping URL: /
Ping Frequency: 10

残りのパラメータは、デフォルト値のままにしておき、「OK」をクリックします。

Move your mouse over this icon to see the image

 

4.

Restart Web Cache」をクリックしてWeb Cacheを再起動します。

Move your mouse over this icon to see the image

 

確認を要求されたら「Yes」をクリックします。

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

5.

Sites」をクリックします。

Move your mouse over this icon to see the image

 

「Named Sites Definitions」の下にあるlocalhost:7777を 選択し「Edit」をクリックします。

 

Move your mouse over this icon to see the image

 

6.

「Available Origin Servers」列の下に新しいオリジナル・サーバーが表示されます。 このオリジナル・サーバーを選択し、「Selected Origin Servers」列に移します。

Move your mouse over this icon to see the image

 

OK」をクリックします。

 

Move your mouse over this icon to see the image

 

 

7.

Restart Web Cache」をクリックしてWeb Cacheを再起動します。

Move your mouse over this icon to see the image

 

確認を要求されたら「Yes」をクリックします。

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

 

 

OracleAS Web Cacheでは、定期的にオリジナル・サーバーに対してユーザー定義のURLを送信し、アプリケーションの可用性を検出します。 応答がない場合、OracleAS Web Cacheはオリジナル・サーバーが使用不可とみなします。 オリジナル・サーバーからの応答がないということは、アプリケーションに問題があることにもなります。 そのため、Ping URLはアプリケーションの検出にも役立ちます。

 

1.

ブ レッドクラム(階層)内の「Web Cache」をクリックして、OracleAS Web Cache Homeページに戻ります。

Move your mouse over this icon to see the image

 

Administration」 タブをクリックし、「Properties」の下にある「Origin Servers」をクリックします。

 

Move your mouse over this icon to see the image

 

2.

オリジナル・サーバーのいずれかを選択し、「Edit」をクリックします。

Move your mouse over this icon to see the image

 

3.

「Ping URL」フィールドに/hrappと入力します。 /hrappは、オリジナル・サーバーからのリダイレクト・ヘッダーで、サイズはゼロ・バイトです。 /hrappは、オリジナル・サーバーのリソースをほとんど必要としないため、Ping URLの候補として最適です。

Move your mouse over this icon to see the image

 

4.

このOBEでは、オリジナル・サーバーにかかる負荷は小さいと想定しています。 特定のオリジナル・サーバーを使用してOracleAS Web Cacheで設定できる最大同時接続数を少なくするには、「Capacity」 の値を50に変更します。 「OK」をクリックします。

Move your mouse over this icon to see the image

 

5.

もう一方のオリジナル・サーバー(localhost:7779)について、手順2~4を繰り返 します。 「Restart Web Cache」をクリックしてWeb Cacheを再起動します。

Move your mouse over this icon to see the image

 

確認を要求されたら「Yes」をクリックします。

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

 

 

Oracle Application Server 10g Release 2では、OracleAS Web Cacheにセッション・バインディング・メカニズムのオプションとして、CookieベースOC4J ベース内部トラッキングの3つのオプションが用意されています。
Cookieベースのセッション・バインディング・メカニズムは、すべてのタイプのWebアプリケーションに適用されます。 OracleAS Web Cacheは、オリジナル・サーバーに対してスティッキー・セッションを実行するための独自のCookieを生成します。そのため、アプリケーションの セッションIDが変更しても、スティッキー・セッションは保持されます。
OC4Jベースのメカニズムは、キャッシュ対象のアプリケーションがOC4Jに基づいている場合に使用します。 OracleAS Web Cacheでは、OC4Jへの各要求でOracle HTTP Serverを経由してルーティング情報を転送します。
アプリケーションがCookiesをサポートしないか、またはOC4Jベースではない場合、内部トラッキング・メカニズムを使用します。 この場合、メモリー内ルーティング表はOracleAS Web Cacheによって保持されます。
この項では、Cookieベースのセッションを使用するようにWeb Cacheを構成します。

 

1.

「OracleAS Web Cache Home」ページにナビゲートします。 「Administration」タブをクリックし、「Properties」の下 にある「Sites」をクリックします。

Place the cursor over this icon to see the image

 

2.

「Named Site Definitions」の下にあるlocalhost:7777を 選択し「Edit」をクリックします。

Place the cursor over this icon to see the image

 

3.

Advanced」タブをクリックして、詳細セクションに進みます。

Place the cursor over this icon to see the image

 

4.

「Session Binding」の下で、「Enable session binding for this site」が選択されていることを確認します。 「Session」ドロップダウン・リストか ら「Any Set Cookies」を選択し、「Session Binding Mechanism」ドロップダウン・ リストから「Cookie-Based」を選択します。 「OK」をクリックします。

Place the cursor over this icon to see the image

 

5.

Restart Web Cache」をクリックしてWeb Cacheを再起動します。

Move your mouse over this icon to see the image

 

確認を要求されたら「Yes」をクリックします。

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

 

1.

ブラウザ・ウィンドウを開き、http://localhost:7777/hrappで アプリケーションを参照します。 OracleAS Web Cacheは、キャッシュ済ページを処理し、要求をオリジナル・サーバーへ送信します。

 

2.

Application Server Control Consoleのブラウザ・ウィンドウに切り替えます。 「OracleAS Web Cache Home」ページにナビゲートします。 Performance」タブに進み「Origin Servers」 をクリックします。

Place the cursor over this icon to see the image

 

3.

最初のオリジナル・サーバーのリンクをクリックします。

Place the cursor over this icon to see the image

 

Request Throughput」の下の「Total Requests」を確認します。

 

Place the cursor over this icon to see the image

 

4.

ブラウザの「戻る」ボタンをクリックし、2つ目のオリジナル・サーバーのリンクをクリックしま す。

Place the cursor over this icon to see the image

 

Request Throughput」の下の「Total Requests」を確認します。

 

Place the cursor over this icon to see the image

 

要求のほとんどは、1つのオリジナル・サーバーのみに集中していることに注意してください。 セッション・バインディングは、適正に機能しています。

 

 

J2EEアプリケーションの場合、OracleAS Web CacheはJSESSIONIDを使用して セッション・バインディングを行います。 ただし、セッション・バインディングの設定を変更する必要があります。

 

1.

「OracleAS Web Cache Home」ページに戻り、「Administration」タブをクリックします。 「Properties」 の下の「Sites」をクリックします。

Move your mouse over this icon to see the image

 

localhost:7777を選択し「Edit」をクリックしま す。

 

Move your mouse over this icon to see the image

 

2.

Advanced」タブをクリックして、詳細セクションに進みます。

Place the cursor over this icon to see the image

 

「Session Binding」の下で、「Enable session binding for this site」が選択されていることを確認します。 「Session」ドロップダウン・メニュー から「JSESSIONID」を選択し、「Session Binding Mechanism」ドロップダウン・メニューから「OC4J-Based」 を選択します。 「OK」をクリックします。

 

Place the cursor over this icon to see the image

 

3.

Restart Web Cache」をクリックしてWeb Cacheを再起動します。

Move your mouse over this icon to see the image

 

確認を要求されたら「Yes」をクリックします。

 

Move your mouse over this icon to see the image

 

Move your mouse over this icon to see the image

 

4.

アプリケーションの参照に使用したブラウザ・ウィンドウに切り替えます。 http://localhost:7777/hrappで、 再度ページを参照します。

 

5.

Application Server Control Consoleのブラウザ・ウィンドウに戻り、ほとんどの要求がオリジナル・サーバーの1つに集中していることを確認します。 「セッション・バインディングのための構成の確認」の項の手順2~4に従って、確認してください。

Place the cursor over this icon to see the image

 

Place the cursor over this icon to see the image

 

 

このレッスンでは、次の ことを学びました。

アプリケーションの可用性を検出するための Ping URLの定義

CookieベースのセッションおよびJSESSIONIDを 使用するためのOracleAS Web Cacheの構成

関連情報

OracleAS Web Cacheの詳細は、ここをク リックしてください。

このアイコンの上にカーソルを置くと、すべてのスクリーンショットが非表示になります。

Copyright © 2004 Oracle Corporation. All Rights Reserved.