統合キャッシング
"http://livehttpheaders.mozdev.org/."
統合キャッシュの仕組み
| 取引タイプ | 仕様 |
|---|---|
| キャッシュヒット | NetScalerアプライアンスがキャッシュから処理する応答には、画像ファイルや静的Webページなどの静的オブジェクト、200個のOKページ、203個の非正規応答ページ、300個の複数選択ページ、301個の永久移動ページ、302個の見つかったページ、304個の未変更ページ、これらの応答は肯定的な応答と呼ばれます。NetScalerアプライアンスは、次の否定的な応答もキャッシュします:307の一時リダイレクトページ、403ページの禁止ページ、404ページの見つからないページ、410ページの消失ページ。パフォーマンスをさらに向上させるには、より多くの種類のコンテンツをキャッシュするようにNetScalerアプライアンスを構成できます。 |
| 保存可能なキャッシュミス | 保存可能なキャッシュミスの場合、NetScalerアプライアンスはオリジンサーバーからの応答を取得し、その応答をキャッシュに保存してからクライアントに提供します。 |
| 保存できないキャッシュミス | 保存できないキャッシュミスはキャッシュには不適切です。デフォルトでは、201、202、204、205、206 ステータスコード、403、404、410、5xx ステータスコードを除くすべての 4xx コードを含む応答は、保存できないキャッシュミスです。 |
ダイナミックキャッシュの仕組み
GET /mybugreportingsystem/mybugreport.dll?IssuePage&RecordId=31231&Template=view&TableId=1000
Host: mycompany.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,\*/\*;q=0.8
Accept-Language: en-us,en;q=0.5
-
問題ページ
-
レコード ID
-
テンプレート
-
テーブル ID
-
HTTP リクエストで mybugreportingsystem という文字列と GET メソッドを検索するキャッシュポリシーを設定します。このポリシーは、一致するリクエストをバグのコンテンツグループに転送します。
-
バグのコンテンツグループでは、IssuePage、RecordID など、さまざまなパラメーターと値のペアに一致する
hitセレクターを設定します。
GET /mybugreportingsystem/mybugreport.dll?IssuePage&RecordId=31231&Template=view&TableId=1000
GET /mybugreportingsystem/mybugreport.dll?IssuePage&Template=viewbtns&RecordId=31231&TableId=1000
GET /mybugreportingsystem/mybugreport.dll?IssuePage&Template=viewbody&RecordId=31231&tableid=1000
-
mybugreportingsystem という文字列と POST HTTP リクエストメソッドを検索し、一致するリクエストをバグレポート用のコンテンツグループに送るリクエストをリクエスト時無効化ポリシーです。
-
RecordID パラメーターに基づいてキャッシュされたコンテンツを期限切れにするバグレポート用のコンテンツグループの無効化セレクター。このパラメータはすべてのレスポンスに表示されるので、無効化セレクターはキャッシュ内のすべての関連項目を期限切れにすることができます。
POST /mybugreportingsystem/mybugreport.dll?TransitionForm HTTP/1.1\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.23 [en]\r\n
Host: mybugreportingsystem\r\n
Cookie:ttSearch.134=%23options%3Afalse%23active%23owner%3Afalse%23unowned%3Afalse%23submitter%3Afalse%23incsub%3Atrue;
Cookie2: $Version=1\r\n
. . .
\r\n
ProjectId=2&RecordId=31231&TableId=1000&TransitionId=1&Action=Update&CopyProjectId=0&ReloadForm=0&State=&RecordLockId=49873+issues+in+HTTP&F43. . .
-
リクエストを無効化ポリシーと照合します。
-
ポリシーで指定されたコンテンツグループを検索します。
-
このコンテンツグループに無効化セレクターを適用し、recordId=31231 に一致するすべての応答を期限切れにします。
統合キャッシュの設定
-
統合キャッシュライセンスが必要です。
-
Citrix からライセンスコードを取得し、コマンドラインインターフェイスにアクセスしてログインします。
/nsconfig/licenseフォルダーにコピーします。
-
次のコマンドを使用して、NetScaler アプライアンスを再起動します。
reboot
enable ns feature IC
キャッシュのグローバル属性を構成する
set cache parameter [-memLimit <MBytes>] [-via <string>] [-verifyUsing <criterion>] [-maxPostLen <positiveInteger>] [-prefetchMaxPending <positiveInteger>] [-enableBypass(YES|NO)] [-undefAction (NOCACHE|RESET)]
NetScaler GUIによる統合キャッシュの有効化
NetScaler GUIを使用してキャッシュのグローバル設定を構成する
統合キャッシュの組み込みコンテンツグループ、パターンセット、およびポリシーを設定する
| 統合キャッシュポリシー名 | ポリシールール |
|---|---|
| _cacheVPNStaticObjects | HTTP.REQ.URL.SET_TEXT_MODE(IGNORECASE).CONTAINS_INDEX("ctx_file_extensions").BETWEEN(101,150) |
| _cacheTCPVPNStaticObjects | HTTP.REQ.URL.ENDSWITH(".css") |
| _cacheOCVPNStaticObjects | HTTP.REQ.URL.ENDSWITH(".pdf") |
| _cacheWFStaticObjects | HTTP.REQ.URL.ENDSWITH(".js") |
| _mayNoCacheReq | HTTP.RES.HEADER("Content-Type").CONTAINS("application/x-javascript") |
| _noCacheRest | TRUE |
フラッシュキャッシュ設定
flush cache contentgroup all
例
0x00000089bae000000004 DEFAULT GET //1.1.1.1:80/html/index.html?name=hello
0x00000089bae000000005 DEFAULT GET //1.1.1.1:80/html/index.html?name=hi
Flush cache contentGroup all
done
`flush cache contentgroup <content group name>`
0x00000089bae000000004 DEFAULT GET //1.1.1.1:80/html/index.html?name=hello
0x00000089bae000000005 DEFAULT GET //1.1.1.1:80/html/index.html?name=hi
Flush cache ob -| 0x00000089bae000000004
done
`flush cache object (-locator <positive_integer> | (-url <URL> (-host <string> [-port <port>] [-groupName <string>] [-httpMethod ( GET | POST )])))`
0x00000089bae000000006 DEFAULT GET //1.1.1.1:80/html/index.html
flush cache ob -URL /html/index.html -host 1.1.1.1 -groupName DEFAULT
done
NetScaler GUIを使用してキャッシュ構成をフラッシュする
さまざまなシナリオに対応した統合キャッシュの設定
set cache parameter -memlimit <value>
統合キャッシュが有効で、キャッシュメモリの制限がゼロ以外に設定されている
CLI を使用して設定する
-
キャッシュパラメータを表示します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 MBytes
Memory usage limit (active value): 500 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
ゼロ以外のメモリ制限を設定する
set cache parameter -memlimit 600
-
構成を保存します
save config
-
シェルプロンプトから、次のコマンドを実行して構成ファイルで確認します。
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 600 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 0 -enableBypass YES -undefAction NOCACHE
-
アプライアンスを再起動します
root@ns# reboot
-
メモリ制限の新しい値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 MBytes
Memory usage limit (active value): 600 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
統合キャッシュは無効で、キャッシュメモリの制限はゼロ以外に設定されています
CLI を使用して設定する
-
キャッシュパラメータを表示します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
新しいメモリ制限を設定する
set cache parameter -memlimit 500
-
構成を保存します
save config
-
シェルプロンプトから、次のコマンドを実行して構成ファイルで確認します
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 500 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 0 -enableBypass YES -undefAction NOCACHE
-
メモリ制限の新しい値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 MBytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
統合キャッシュ機能を有効にする
enable ns feature IC
-
メモリ制限の新しい値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 Mbytes
Memory usage limit (active value): 500 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
構成を保存して、アプライアンスの再起動時にメモリが自動的に機能に割り当てられるようにします。
統合キャッシュが有効で、キャッシュメモリがゼロに設定されている
CLI を使用して設定する
-
シェルプロンプトからns.confファイルに設定されているメモリ制限を確認します
root@ns# cat ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 0 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
-
メモリ制限の値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 0 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
統合キャッシュ機能がオブジェクトを確実にキャッシュするようにメモリ制限を設定します
set cache parameter -memLimit 600
-
メモリ制限の値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 600 Mbytes
Memory usage limit (active value): 600 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3:
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
構成を保存します。アプライアンスの再起動時に、メモリが自動的に機能に割り当てられるようにしてください。
-
シェルプロンプトからns.confファイルに設定されているメモリ制限を確認します
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 600 -via NS-CACHE-9.3: -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
統合キャッシュが無効になり、キャッシュメモリがゼロに設定されます
CLI を使用して設定する
-
シェルプロンプトからns.confファイルに設定されているメモリ制限を確認します
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 0 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE
-
メモリ制限の値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 0 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3: 18
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
統合キャッシュ機能を有効にする
enable ns feature IC
-
統合キャッシュ機能がオブジェクトを確実にキャッシュするようにメモリ制限を設定します
set cache parameter -memLimit 500
-
メモリ制限の値を確認します
> show cache parameter
Integrated cache global configuration:
Memory usage limit: 500 Mbytes
Memory usage limit (active value): 500 Mbytes
Maximum value for Memory usage limit: 843 MBytes
Via header: NS-CACHE-9.3:
Verify cached object using: HOSTNAME_AND_IP
Max POST body size to accumulate: 0 bytes
Current outstanding prefetches: 0
Max outstanding prefetches: 4294967295
Treat NOCACHE policies as BYPASS policies: YES
Global Undef Action: NOCACHE
-
構成を保存します
save config
-
シェルプロンプトからns.confファイルに設定されているメモリ制限を確認します
root@ns# cat /nsconfig/ns.conf | grep memLimit
-
メモリ制限を変更する
set cache parameter -memLimit 500 -via NS-CACHE-9.3: 18 -verifyUsing HOSTNAME_AND_IP -maxPostLen 4096 -enableBypass YES -undefAction NOCACHE