監視 Java 應用程式Monitoring Java applications

重要

已不再支援此版本的 Operations Manager,建議升級至 Operations Manager 2019This version of Operations Manager has reached the end of support, we recommend you to upgrade to Operations Manager 2019.

System Center - Operations Manager 中的 Java 應用程式效能監視 (APM) 可讓您監視 Java 應用程式,以取得應用程式效能和例外狀況事件的詳細資料,協助您判斷問題的根本原因。Java Application Performance Monitoring (APM) in System Center - Operations Manager lets you monitor Java applications to get details about application performance and exception events that can help you determine the root causes of problems. Java 應用程式效能監視的 System Center 管理組件可讓您使用 Operations Manager Application Advisor 監視 Java 應用程式效能和例外狀況事件。The System Center Management Pack for Java Application Performance Monitoring lets you monitor Java application performance and exception events by using Operations Manager Application Advisor. 使用 Operations Manager Application Advisor,您可以調查效能事件的方法和資源時間、例外狀況事件的堆疊追蹤、事件的 Java 特定計數器 (例如 [平均要求時間]、[每秒要求數]、[JVM 記憶體] 和 [類別載入器]),以及執行一些標準應用程式效能監視報表。With Operations Manager Application Advisor, you can investigate method and resource timing for performance events, stack traces for exception events, Java-specific counters for events (such as Average Request Time, Requests Per Second, JVM Memory, and Class Loader), and run some of the standard Application Performance Monitoring reports. 另外,您會在 Java 應用程式伺服器計數器上取得 Operations Manager 層級警示。Additionally, you get Operations Manager level alerting on Java application server counters. 請從 Microsoft 下載中心下載 Java 應用程式效能監視的管理組件。Download the Management Pack for Java Application Performance Monitoring from the Microsoft Download Center.

Java 應用程式效能監視有許多概念與 .NET 應用程式效能監視相通。Java Application Performance Monitoring shares many concepts with .NET Application Performance Monitoring. 不過,兩者還是有一些重要的差異,包括:物件階層、使用覆寫和警示的方法 (Java 應用程式效能監視沒有撰寫和設定範本,因此您應使用管理組件覆寫來變更設定),而且伺服器層級資訊不會在 Java 應用程式效能監視報表中處理。However, there are some important differences, including: object hierarchy, the method for working with overrides and alerting (Java Application Performance Monitoring has no authoring and configuration template, so you change configurations with management pack overrides), and sever-level information is not handled in Java Application Performance Monitoring reports.

支援的設定Supported configurations

Java 應用程式效能監視的管理組件需要 Windows Server 2012 R2 和 Operations Manager。The Management Pack for Java Application Performance Monitoring requires Windows Server 2012 R2 and Operations Manager.

支援的設定:Supported configurations:

  • Tomcat 5、Tomcat 6 和 Tomcat 7Tomcat 5, Tomcat 6, and Tomcat 7

    • WindowsWindows

    • LinuxLinux

  • Java JDK 5、Java JDK 6Java JDK 5, Java JDK 6

  • Web 技術Web Technologies

    • GenericServletGenericServlet

    • StrutsStruts

    • Struts2Struts2

    • Axis2Axis2

先決條件Prerequisites

若要執行 Java 應用程式效能監視的管理組件,您必須設定 Java Enterprise Edition (JEE) 的管理組件進行深層監視。To run the Management Pack for Java Application Performance Monitoring, you must have the Management Pack for Java Enterprise Edition (JEE) configured for deep monitoring. 此管理組件會監視 JEE 應用程式伺服器,並提供初始應用程式層級探索。This management pack monitors JEE application servers and provides initial application level discovery. 如需詳細資訊,請參閱如何設定 Java 應用程式的監視以及適用於您的特定應用程式伺服器類型的 JEE 管理組件指南 (可從 Microsoft 下載中心進行下載)。For more information, see How to Configure Monitoring for Java Applications and the Management Pack Guide for JEE for your particular type of application server, available on the Microsoft Download Center.

如何監視 Java 應用程式How to monitor Java applications

當您有新的 Java 應用程式需要瞭解時,可以使用 Java 應用程式效能監視來取得基準測量數據,然後再逐步擴大部署的規模。When you have a new Java application that you are learning about, you use Java Application Performance Monitoring to get baseline measures before you gradually scale up deployment. 本文說明有助於您開始了解新應用程式的一些初始設定。Here are some settings to start with that helps you get to know your new application. 此外,非常適合您先在測試或開發環境中開始監視以建立基準設定,再於生產環境中實作。In addition, it is ideal that you begin monitoring in a test or development environment to establish a baseline configuration before implementing in production.

新應用程式的監視設定Monitoring settings for a new application

依照此策略來監視新的 Java 應用程式,可幫助您了解應用程式在環境內部以及對客戶呈現的運作模式。Following this strategy for monitoring a new Java application will help you get to know how the application behaves within your environment and for your customer.

使用簡單的受監視系統和短期設定開始監視Start monitoring with a simple monitored system and short-term settings

首先,請讓設定保持簡單:監視一部伺服器上的一個應用程式。First, keep the configuration simple: monitor one application on one server. 其次,當您第一次設定 Java 應用程式效能監視來監視新的應用程式時,請規劃充裕的時間來保留您實作的設定,以便瞭解一些趨勢。Second, when you first configure Java Application Performance Monitoring to monitor a new application, plan to keep the settings you implement long enough for you to understand some trends. 一天的資料應該足以讓您瞭解應用程式的效能和使用模式。A day's worth of data should provide you with insight into the performance and usage patterns of the application.

使用預設設定和部分特定設定建立基準效能Establish baseline performance using default settings and some specific settings

通常,您可以保留預設設定。Usually, you will want to keep default settings. 預設設定可確保您能夠發現應用程式的任何大問題,並將對受監視應用程式造成的影響降到最低。The default settings ensure that you will see any large issues with the application and keep the impact on the monitored application at a minimum.

如果沒有發生任何效能或例外狀況事件,您可以使用下列步驟來對基準效能的操作有初步的瞭解。If you are not getting any performance or exception events raised, you can use the following steps to get a feel for what the baseline performance looks like.

若要開始進行監視,您可以按照此處所述方式調整的下列幾項設定:To begin monitoring, here are some settings you might want to adjust as noted here:

  • 降低效能的閾值。Lower the thresholds for performance. 這可讓您查看應用程式目前的效能特性,協助您建立基準效能測量標準。This helps you establish a baseline performance measure by seeing what the current performance characteristics of the application are. 如需效能閾值的詳細資訊,請參閱如何設定 Java 應用程式的監視For more information about performance thresholds, see How to Configure Monitoring for Java Applications.

  • 檢查所有例外狀況。Examine all exceptions. 您需要知道擲回的例外狀況類型。You need to know what kinds of exceptions are being thrown. 請使用已知的例外狀況處理常式限制您將收到的例外狀況。Using known exception handlers limits the exceptions you will receive.

這可能會產生大量資料,對於長期監視來說超乎所需。This can result in signifcant data, more than you would want for long-term monitoring. 這樣的資料量一開始會很有用,因為您可以了解多項趨勢,例如客戶透過系統採取的路徑類型,以及一般的效能為何。Initially, this amount of data will be helpful as you will see trends, such as the kinds of paths customers are taking through the system and what normal performance looks like.

當資料收集完成時,請使用 Application Advisor 報表 (例如應用程式效能分析) 查看受監視應用程式的狀況。With the data collection complete, use the Application Advisor reports, such as Application Performance Analysis, to see how the monitored applications are looking. 您可以利用報表查看系統中負載最重 (執行時間最長) 呼叫的平均持續時間,以及處理要求所花的最長時間。Using the report you will see what the average duration is for the heaviest (longest running) calls through the system as well as the maximum amount of time spent processing requests. 如此,您便可根據實際的應用程式效能,設定自訂的智慧閾值。This allows you to set customized smart thresholds based on real application performance. 您也會看到哪些功能的執行速度比其他功能快,而且您可以針對重要方法建立特定網頁、Web 方法和函式交易,以確保這些方法能夠在比整個應用程式更嚴密的 SLA 之下進行回應。You will also see which functions are running faster than others, and you can create specific web page, web method, and function transactions for the critical methods so that you can ensure they are responding under a tighter SLA than the application as a whole. 如需檢視報表的詳細資訊,請參閱使用 Application Advisor 設定警示優先順序,了解如何界定 Application Advisor 報表範圍和執行報表。For more information on viewing reports, see how to scope and run an Application Advisor report in Prioritizing Alerts by Using Application Advisor.

調整設定並與基準比較Adjust settings and compare to the baseline

建立基準效能測量標準後,請開始調整設定來微調監視,以偵測產生的例外狀況類型。Once you have established a baseline performance measure, begin to adjust the settings to tune the monitoring so it catches the kinds of exceptions that are being raised. 藉由回報所有例外狀況,您可以確認應用程式中是否有任何預設例外狀況處理程式能夠偵測您希望收到警示的例外狀況。By reporting all exceptions, you will see if there are any default exception handlers in the application that are catching exceptions for which you would prefer receiving alerts. 隨著每次的調整,您所取得的資料將會更有意義,而且資料量也會減少。The data you get will be more meaningful and lower in volume with each adjustment.

  • 移除自訂設定並根據收集到的資料設定閾值。Remove the custom settings and set thresholds based on the data collected.

  • 針對任何應用程式層級的「全部偵測」處理常式新增例外狀況處理常式,以避免例外狀況出現在應用程式以外。Add exception handlers for any application level "catch all" handlers that keep exceptions from going outside the application.

  • 新增特殊交易來監視常見方法的效能;這些方法的 SLA 應比整體應用程式更嚴密。Add specialized transactions to monitor the performance of common methods that should be held to a stronger SLA than the application as a whole.

將新資料與基準比較。Compare the new data to your baseline. 例如,您將開始看到實際的平均回應時間。You will begin to see the real average response time, for instance. 現在您已知道應用程式傳送的各種效能例外狀況,接著就可以新增您所需的特定命名空間,而不是監視所有命名空間。Now that you know the various performance exceptions the application is sending, you can add the specific namespaces you want rather than monitoring all namespaces. 您的應用程式將設定為根據觀察到的效能層級進行監視,如果超過正常範圍之外,就會收到警示。Your application will be configured to be monitored based on the observed performance levels and will be alerted if things move outside of normal levels.

將應用程式逐步部署到更多受監視的伺服器Gradually deploy the application to more monitored servers

使用新的監視設定監視應用程式一段時間後,當您認為應用程式狀況良好時,請增加執行應用程式並進行監視的伺服器數目,例如從 1 部增加到 10 部。After monitoring the application for a time with the new monitoring configuration, when you feel your application is healthy, increase the number of servers you are running the application on and monitoring from one to 10, for example. 等到在該層級的執行狀況良好時,請再將部署和監視規模擴充到更多伺服器,並以此類推。Once you have it running healthy at that level, increase the deployment and monitoring to more servers, and so on. 這種逐步部署方式可提升您對於監視該應用程式的信心,並有助於確保系統的健全狀況。This gradual rollout approach will help you gain confidence in the monitoring for that application and help ensure the health of your system.

操作人員可以使用這項資訊來執行哪些工作What the operator can do with this information

利用這些基本資訊,操作人員可以更清楚瞭解問題是出在應用程式還是基礎結構,而且可以知道這個問題是只能交由開發團隊解決,還是可由操作人員直接解決。Using this basic information, the operator can have a better idea where the problem is with the application or with the infrastructure and know whether it is something only to the development team can fix or the operator can address directly.

後續步驟Next steps

如需設定 Java 應用程式監視的詳細資訊,請參閱如何設定 Java 應用程式的監視For details about configuring monitoring of Java applications, see How to Configure Monitoring for Java Applications.