分享方式:


使用 Azure 負載測試來監視伺服器端應用程式計量

在本文中,您會了解在使用 Azure 負載測試來執行負載測試時,如何擷取和監視伺服器端應用程式計量。 當您對 Azure 託管的應用程式執行負載測試時,Azure 負載測試會收集應用程式元件的資源計量,並將其顯示在負載測試儀表板中。

若要在負載測試期間擷取計量,您會更新負載測試組態,並新增組成應用程式的 Azure 應用程式元件。 服務會自動為這些應用程式元件選取最相關的資源計量,取決於元件類型。 您可以選擇性地針對每個 Azure 元件更新伺服器端計量的清單

Azure 負載測試會與 Azure 監視器整合,以擷取 Azure 託管應用程式的伺服器端資源計量。 深入了解 Azure 負載測試支援哪些 Azure 資源類型

必要條件

  • 具有有效訂用帳戶的 Azure 帳戶。 如尚未擁有 Azure 訂用帳戶,請在開始之前先建立免費帳戶
  • Azure 負載測試資源。 若要建立負載測試資源,請參閱建立和執行負載測試

將 Azure 應用程式元件新增至負載測試

若要針對 Azure 裝載的應用程式監視資源計量,您必須在負載測試組態中指定 Azure 應用程式元件的清單。 Azure 負載測試會自動針對每個選取的元件擷取一組相關資源計量。 在負載測試期間和在測試完成之後,您可以在負載測試儀表板中檢視伺服器端計量。

如需 Azure 負載測試支援的 Azure 元件清單,請參閱支援的 Azure 資源類型

使用下列步驟來設定 Azure 元件進行負載測試:

  1. Azure 入口網站中,移至您的 Azure 負載測試資源。

  2. 在左窗格中,選取 [測試],然後從清單中選取您的負載測試。

  3. 在 [測試詳細資料] 頁面上,選取 [設定],然後選取 [應用程式元件],以新增或移除要在負載測試期間監視的 Azure 資源。

    Screenshot that shows the 'App Components' button for displaying app components to configure for a load test.

  4. 在 [設定應用程式元件] 頁面上,為您要新增或移除的 Azure 資源選取或清除核取方塊,然後選取 [套用]

    Screenshot that shows how to add or remove app components from a load test configuration.

    當您執行負載測試時,Azure 負載測試會在測試回合儀表板中為選取的應用程式元件顯示預設資源計量。

您可以隨時針對每個應用程式元件變更資源計量的清單。

設定負載測試的資源計量

當您將應用程式元件新增至負載測試組態時,Azure 負載測試會為這些元件新增最相關的資源計量。 您可以針對負載測試中的每個應用程式元件新增或移除資源計量。

請使用下列步驟來檢視和更新負載測試的資源計量清單:

  1. 在 [測試詳細資料] 頁面上,選取 [設定],然後選取 [計量],以選取要在負載測試期間擷取的特定資源計量。

    Screenshot that shows the 'Metrics' button to configure metrics for a load test.

  2. 更新您想要擷取的計量清單,然後選取 [套用]

    Screenshot that shows a list of resource metrics to configure for a load test.

  3. 選取 [執行] 以使用新的組態設定來執行負載測試。

    Screenshot that shows the 'Run' button for running the load test from the test details page.

    請注意,測試結果儀表板現在會顯示更新的伺服器端計量。

    Screenshot that shows the updated server-side metrics on the test result dashboard.

注意

在您更新負載測試的負載測試組態時,所有未來的測試回合都會使用更新的組態。 您也可以更新負載測試儀表板上的應用程式元件和計量。 在此情況下,組態變更僅適用於目前測試回合。