使用VisualVM進行Java應用的效能測量
Recently I am trying to find a handy tool to measure the performance of my Java application and finally I think the VisualVM provided by JDK is the ideal one. This blog is written based on JDK1.7 + Eclipse 4.3.2.
What is VisualVM
It is a tool automatically available after JDK is installed. The executable file could be found on your /bin as displayed below.
In order to measure the performance of your application, it is necessary for the application to be recognized by VisualVM first. There is a plugin named “VisualVM launcher for Eclipse” which can help us about it.
Install and configure VisualVM launcher
(1) download the zip from http:// visualvm.java.net/eclip se-launcher.html . Unzip the file and put it to the plugin folder of your Eclipse installation folder. In my laptop it looks like below. There should be a site.xml inside the unzipped folder.
(2) In Eclipse, choose menu “Help->Install New Software”, click “Local”, add locate the folder to the one you finish in step1.
Then the local downloaded plugin is successfully parsed and ready for install.
finish the installation.
(3) Restart Eclipse, then you can find a new option via the path below. Configure two paths accordingly.
For “JDK Home”, if you configure the JRE path by mistake, later when you try to measure your application, the VisualVM will fail to load with the following error message:
Now the plugin is ready to use.
Do performance measurement
(1) Select your Java project, choose context menu “Run as”->”Run configuration”, create a new Application configuration by specifying VisualVM launcher as its launcher, instead of the default Eclipse JDT launcher.
(2) For example I have a Java application which sorts an array by QuickSort algorithm written by myself and I would like to get its performance data, then I set a breakpoint on line 57, before my main logic is executed. Then launch the application in debugging mode with the application configuration created in previous step. Afterwards VisualVM will automatically be launched and successfully recognize the execution of my application. Click Profiler tab:
Current status: profiling inactive. Click CPU button:
Now profiling is activated:
(3) Go back to Eclipse and click F8 to finish execution. Once finished, VisualVM will immediately capture this event and notify you. Just click Yes to get performance result.
The result is displayed as below:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2717882/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用JDK自帶的VisualVM進行Java程式的效能分析JDKLVMJava
- 使用VisualVM對JAVA程式進行效能分析及調優LVMJava
- 使用火焰圖進行Java應用效能分析Java
- 【java】使用jprofiler進行效能測試Java
- 使用 ABAP 事物碼 SAT 對從瀏覽器開啟的 SAP應用進行效能監控和測量瀏覽器
- Java效能監控工具:VisualVMJavaLVM
- 使用springloaded進行java應用熱部署SpringJava熱部署
- 效能測試之JVM的故障分析工具VisualVMJVMLVM
- 如何使用SAP事務碼SAT進行UI應用的效能分析UI
- 使用 Dynatrace 對 Node.js 應用的效能資料進行分析Node.js
- 使用 Sysbench 進行 Linux 效能測試Linux
- 使用Iperf工具進行網路效能測試
- 使用YCSB工具工具進行cassandra效能測試
- 使用QTP進行WEB頁面效能測試QTWeb
- 使用Java後端對Angular應用進行Docker化 -BhargavJava後端AngularDocker
- 使用 Java 進行移動應用開發的 8 個理由 - VikrantJava
- 使用Bonnie進行系統IO效能測試 (zt)
- 使用應用程式跟蹤對效能改變進行量化分析(轉)
- Flutter應用進行自動化測試Flutter
- [譯] 使用 Kotlin 協程改進應用效能Kotlin
- 使用Memcached改進Java企業級應用效能(1):架構和設定Java架構
- visualvm 效能調優工具LVM
- 使用python對oracle進行簡單效能測試PythonOracle
- 【TEST】Oracle19c使用benchmarksql進行效能測試OracleSQL
- 使用tpcc-mysql對mysql進行TPCC效能測試MySql
- JMH-大廠是如何使用JMH進行Java程式碼效能測試的?必須掌握!Java
- Android Studio 3.0 利用 Android Profiler 測量應用效能Android
- 基於PostgreSQL進行Java應用開發SQLJava
- Java 應用壓測效能問題定位經驗分享Java
- 【譯】Google - 使用 webpack 進行 web 效能優化(三):監控和分析應用GoWeb優化
- 使用pprof進行效能分析
- 移動應用app測試怎麼進行?APP
- 效能測試進階實踐篇:10分鐘教你使用JMeter進行websocket測試!JMeterWeb
- 使用java+TestNG進行介面迴歸測試Java
- JDBC 在效能測試中的應用JDBC
- 如何使用Nginx對Artifactory進行http應用NginxHTTP
- 效能測試應用領域
- SRE 彈效能力:使用 Envoy 對應用進行速率限制