HAR ファイルの生成と Web リクエストの分析
目的
HAR is the short form for HTTP Archive format, which tracks all the logging of a web browser's interaction with a site.
特に以下のような問題では、問題のトラブルシューティングに HAR ファイルが必要となる場合があります。
- Performance Issue: slow page load, timeouts when performing a specific task
- Page rendering: incorrect page format, missing information
First-line troubleshooting can be conducted by following this guide. Providing this information to the support team will help speed up troubleshooting.
はじめる前に
Please be sure to take note of the Supported Platforms page for the supported browser types.
It is highly recommended that multiple HAR files be generated for comparison. Below are guidelines for effective information gathering:
- Generate a HAR file for an unaffected page (without performance or page rendering issues). Example. Dashboard, Issue View, Issue Search, and Project page.
- Generate a HAR file for an affected page. Generate multiple times to get a better average and capture consistent timing
ソリューション
Below demonstrates how HAR files are generated depending on your browser variant.
Web リクエストの分析
The steps taken to analyze the Web Requests captured by the HAR file vary depending on the troubleshooting Performance or Page Rendering issue.
A common tool to view the generated HAR files is HAR Viewer, available as a web application.
パフォーマンスの問題のトラブルシューティング
The relevant information for performance issues is the load time and which request is causing the delay in the browser serving the content to the user. So, an understanding of the definitions used for Web Request is required for effective troubleshooting; see below:
The below is extracted from a HAR file loaded in HAR Viewer or Google's tool, HAR Analyzer.
HAR ファイルの読み込み後に Web リクエストを強調表示すると、次の情報が表示されます。
Request start time since the beginning
The highlighted request is called after how long from the initial request. Example: Like below, +6.32s means the current request is being called 6.32 seconds after the initial request (Most of the time, the HTML request is the initial one)
Waiting
Amount of time waiting for the server to respond. If this value is high, it could mean:
- If the time waiting is low locally, then the network between your client and the server is the problem. Any number of things could hinder the network traversal. There are a lot of points between clients and servers; each one has its own connection limitations and could cause a problem. The simplest method to test reducing this is to put your application on another host and see if the time waiting improves.
- That the server is busy or suffering a performance issue. Below, we can see that there is around 2 second wait time from the server; this scenario was due to a complex JQL query:
If this is always seen during a specific time of the day, record the time of occurrence and create a support ticket at support.atlassian.com for assistance in identifying the root cause.
Receiving
This is the time the server uses to transfer the required information to the client. Typically, this is where we detect a network issue. See below for an example:
This example above has a 1.6-second wait time, which caused most of the delay in completing the request.
DOM Loaded
DOM loaded means that the browser has received and parsed all the HTML into the DOM tree, which can now be manipulated.
It occurs before the page has been fully rendered (as external resources may still need to be fully downloaded, including images, CSS, JavaScript, and any other linked resources).
Don't confuse with onload event:
The onload event occurs when an object has been loaded. onload is often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.).
The onload event can be used to check the visitor's browser type and browser version and load the proper version of the web page based on the information.
参照: http://www.w3schools.com/jsref/event_onload.asp
Page Loaded
Total time taken for the page to be fully loaded. (Inclusive of AJAX call or any REST call from javascript to populate data on external server: Example, Google Analytics)
It does not mean that the page is white without any content until it is fully loaded; the page usually will show after the onload event, and then it will populate the information from the external call. Such as Dashboard Gadget when loading:
If you have external resources to populate the page (Gadgets, external links), It could take a longer time to load the page completely, however, it does not depend on the performance of the server but rather the speed to handle the request from other site/server.
サイズ
The size of the request being served plays a role in performance issues as well; for a better understanding of how it contributes to delay, see below:
2.4MB のデータの取得にかかる時間はどれぐらいでしょうか。次のように計算されます。
3 Mbps = 約 0.375MBps (注: B = バイト、b = ビット)
To get 2.4MB, you will need:
2.4 MB / 0.375 MBps = 6.4 秒
This depends on the throughput available. Generally, you can run a Speed Test and check the throughput of the server nearest to the hosting datacenter.
A similar view is obtained by viewing the Network tab on the respective browser types listed above.
The steps to analyze are very straightforward if the above definition is clearly understood:
- Search for the delayed responding request (typically the longest bar viewing the total web requests)
- Identify what is the longest waiting time and how long it waited
- 遅延の主な原因を確認します (Blocking、Waiting、Receiving)
- ページを複数回リロードして問題が再現するかどうかを確認します
- Seek assistance from the Support team with the information captured if identifying the server contributes to the delay. For other issues, such as network, reaching out directly to the ISP or internal hosting team for assistance is faster. The information gathered should be sufficient to show the observation.
レンダリングの問題のトラブルシューティング
ページのレンダリングに失敗する場合、開発者ツール の [ネットワーク] タブに原因が記録されていることが多くあります。原因が記録されていない場合、[キャッシュの無効化] の横のチェックボックスを選択してブラウザ キャッシュを無効化することをおすすめします。これにより、ブラウザでキャッシュ データを使用せずにページを最初からレンダリングできます。同様に、HAR ファイルのステータス コードも、問題の原因となるリクエストの特定に役立ちます。
Example of an error message seen in the Console tab accompanying the code 404 Bad Request
:
{"errorMessages":["Error in JQL Query: Expecting either a value, list or function but got 'IN'. You must surround 'IN' in quotation marks to use it as a value. (line 1, character 11)"],"errors":{}}
This is found in the bug - JRA-42216Getting issue details... STATUS which is also a page rendering issue
It is essential to be able to identify the status code from the HAR files generated as well. Below are a few of typical examples:
- 200 - 成功
- 404 - ページが見つかりません / 要求が正しくありません
- 401 - 認証されていません
- 403 - 禁止されています
- 304 - 変更されていません (コンテンツはキャッシュされています)
- 500 - 内部サーバー エラー
For the definition of the error, refer to the HTTP/1.1 Status Code Definition page for details.
After capturing the consistent behavior, provide this information to the support team together with the steps taken for the Support team to work on the potential cause behind the observation.