Java应用程序的性能分析器 [英] Performance profiler for a java application
问题描述
我需要优化Java应用程序.它进行一些第三方通话.我需要一些好的工具来准确测量各个API调用所花费的时间. 给一个复杂的想法- 该应用程序需要一个包含一百万行的数据源文件,大约需要一个小时才能完成处理.作为处理的一部分,它会进行一些第3方通话(包括某些网络通话).我需要确定哪些调用比其他调用花费更多的时间,并在此基础上找出优化应用程序的方法.
I need to optimise a Java application. It makes some 3rd party calls. I need some good tool to accurately measure the time taken by individual API calls. To give an idea of complexity- the application takes a data source file containing 1 million rows, and it takes around one hour to complete the processing. As a part of processing , it makes some 3rd party calls (including some network calls). I need to identify which calls are taking more time then others, and based on that, find out a way to optimise the application.
任何建议将不胜感激.
推荐答案
我可以推荐JVisualVM .这是与Oracle/Sun JDK捆绑在一起的出色的监视/性能分析工具.只需启动它,连接到您的应用程序并启动CPU分析即可.您应该在花费的时间上得到很好的直方图.
I can recommend JVisualVM. It's a great monitoring / profiling tool that is bundled with the Oracle/Sun JDK. Just fire it up, connect to your application and start the CPU-profiling. You should get great histograms over where the time is spent.
Getting Started with VisualVM has a great screen-cast showing you how to work with it.
屏幕截图:
另一个更基本的选择是使用-Xprof
命令行选项:
Another more rudimentary alternative is to go with the -Xprof
command line option:
-Xprof
分析正在运行的程序,并将概要分析数据发送到 标准输出.此选项作为实用程序提供,该实用程序是 在程序开发中很有用,并非意在成为 在生产系统中使用.
Profiles the running program, and sends profiling data to standard output. This option is provided as a utility that is useful in program development and is not intended to be be used in production systems.
这篇关于Java应用程序的性能分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!