Java 应用程序的性能分析器

发布于 2024-09-05 12:26:22 字数 207 浏览 1 评论 0原文

我需要优化 Java 应用程序。它会拨打一些第 3 方电话。我需要一些好的工具来准确测量各个 API 调用所花费的时间。 给出复杂性的概念 - 该应用程序获取包含 100 万行的数据源文件,大约需要一小时才能完成处理。作为处理的一部分,它会进行一些第 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.

Any suggestions would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

不…忘初心 2024-09-12 12:26:24

在我们的办公室,我们每天都使用 YourKit 分析器。它的重量确实很轻,可以满足我们所拥有的大多数与性能相关的用例。

但我也用过Visual VM。它免费且快速。在使用 YourKit 之前,您可能首先想尝试一下 Visual VM(YourKit 不是免费软件)。

In our office we use YourKit profiler on a day to day basis. It's really light weight and serves most of the performance related use cases we have had.

But I have also used Visual VM. It's free and fast. You may first want to give Visual VM a try before going towards YourKit (YourKit is not freeware).

蓝海 2024-09-12 12:26:24

VisualVM(SDK 的一部分)和 Java 7 可以生成详细的分析。

visualvm (part of the SDK) and Java 7 can produce detailed profiling.

彩虹直至黑白 2024-09-12 12:26:24

我在 NetBeans 中使用分析器(它非常出色并且已经内置,无需安装插件)或 JVisualVM(不使用 NetBeans 时)。

I use profiler in NetBeans (it is really brilliant and already built in, no need to install plugin) or JVisualVM when not using NetBeans.

深陷 2024-09-12 12:26:23

在这种情况下,听起来普通的探查器可能不是正确的工具,因为它们的目的是测量被探查的程序所花费的 CPU 时间,而不是它调用的外部 API,并且它们往往会产生很高的开销。拥有并收集大量数据,如果长时间运行,这些数据可能会让您的系统不堪重负。

如果你确实需要收集这么长时间的性能数据,并且主要用于外部调用,那么 Perf4J 是可能是一个更好的工具。

It sounds like a normal profiler might not be the right tool in this case, since they're geared towards measuring the CPU time taken by the program being profiled rather than external APIs that it calls, and they tend to incur a high overhead of their own and collect a large amount of data that would probably overwhelm your system if left running for a long time.

If you really need to collect performance data over such a long time, and mainly for external calls, then Perf4J is probably a better tool.

演出会有结束 2024-09-12 12:26:22

我可以推荐 JVisualVM。它是一个很棒的监控/分析工具,与 Oracle/Sun JDK 捆绑在一起。只需启动它,连接到您的应用程序并开始 CPU 分析。您应该获得有关时间花费情况的出色直方图。

VisualVM 入门 有一个很棒的屏幕截图,向您展示如何使用它。

屏幕截图:

VisualVM snapshot


另一个更基本的替代方案是使用 -Xprof 命令行选项:

<代码>-Xprof

<块引用>

分析正在运行的程序,并将分析数据发送到
标准输出。此选项作为实用程序提供
在程序开发中有用,并不是为了
用于生产系统。

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.

Screen shot:

VisualVM screenshot


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.

拧巴小姐 2024-09-12 12:26:22

我已经使用 YourKit 几次了,并且非常满意。然而,我从未分析过长期运行的操作。

每行的处理是否相同?在这种情况下,输入文件的大小并不重要。您可以分析一个子集以找出哪些调用成本较高。

I've been using YourKit a few times and what quite happy with it. I've however never profiled a long-running operation.

Is the processing the same for each row? In which case the size of the input file doesn't really matter. You could profile a subset to figure out which calls are expensive.

寂寞花火° 2024-09-12 12:26:22

只是想提一下spectIT 工具。它最近变得完全开源(https://github.com/inspectIT/inspectIT)。它提供了完整而详细的调用图以及上下文信息,有许多开箱即用的传感器用于数据库调用、http 监控、异常等。Seams

非常适合您的用例。

Just wanted to mention the inspectIT tool. It recently became completely open source (https://github.com/inspectIT/inspectIT). It provides complete and detailed call graph with contextual information, there are many out-of the box sensor for database calls, http monitoring, exceptions, etc.

Seams perfect for your use-case..

云雾 2024-09-12 12:26:22

试用 OPNET 的 Panorama 软件产品

Try OPNET's Panorama software product

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文