Ajax リクエストの数の設定

このページでは、Ajax リクエストの数の設定方法について説明します。

デフォルトでは、JavaScript エージェントは基本または仮想ページ用に送信される Ajax リクエスト(XHR または Fetch API を使用)を制限します。この制限は、シングルページ アプリケーション(SPA)の場合は 250 個、非 SPA の場合は 50 個となります。基本または仮想ページは通常、大量の Ajax リクエストを送信しませんが、場合によっては、ページが冗長な Ajax リクエスト(特にエラーレポートを含む場合)を送信することがあります。

たとえば、新しい情報がないエラーと例外のデッドループを含む一連の冗長 Ajax リクエストによって、EUM サーバが過負荷になる可能性があります。Ajax リクエストの過負荷を防ぐには、基本および仮想ページ用に送信される Ajax リクエストの数を制限するように JavaScript エージェントを構成します。

Set the Number of Ajax Requests

The code example below limits the number of Ajax request per base or virtual page to 7.

<head>
   <script type='text/javascript' charset='UTF-8'>
      window["adrum-start-time"] = new Date().getTime();
      window['adrum-config'] = {
         xhr: {
            maxPerPageView: 7
         }
      };
      ...   
   </script>
   <script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
   ...
</head>

Set an Unlimited Number of Ajax Requests

For use cases where all Ajax requests for a page need to be captured, you can configure the JavaScript Agent to report an unlimited number of Ajax requests per page with the configuration xhr.maxPerPageView.

注: To prevent an overload of Ajax requests, it is highly recommended to only use this configuration for use cases when you absolutely need to capture all Ajax requests.

The following code example configures the JavaScript Agent to report an unlimited number of Ajax requests per page:

<head>
   <script type='text/javascript' charset='UTF-8'>
      window["adrum-start-time"] = new Date().getTime();
      window['adrum-config'] = {
         xhr: {
            maxPerPageView: "UNLIMITED"
         }
      };
      ...   
   </script>
   <script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
   ...
</head>