简体   繁体   English

在自动化Java性能测试期间监视和记录系统指标的工具

[英]Tool to monitor & log system metrics during automated Java performance tests

We have an application using Spring Integration in its core, and have created performance tests to see what is the processing speed (msgs/sec) for different generated input types. 我们有一个在其核心中使用Spring Integration的应用程序,并创建了性能测试以查看不同生成的输入类型的处理速度(msgs /秒)。

This process is automated, so whenever such test is run, a separate instance is created in cloud, and disposed after done & output artefacts copied. 该过程是自动化的,因此无论何时运行此测试,都会在云中创建一个单独的实例,并在完成并复制输出伪像后进行处理。

What I want to do is to have those performance tests monitored during the run for basic system metrics -- CPU, memory, I/O, GC runs/time. 我想要做的是在运行期间监视那些性能测试,以了解基本系统指标-CPU,内存,I / O,GC运行/时间。 Obviously, the result of this should be some CSV files with metrics readings (eg, once or twice a second). 显然,这样做的结果应该是一些带有度量读数的CSV文件(例如,每秒一次或两次)。

So my question is: Are there any good and configurable tools for these purposes? 所以我的问题是: 是否有用于这些目的的好工具和可配置工具?

I'm in the middle of investigation, but profiling tools I reviewed so far mainly require human interaction and are UI oriented. 我正在调查之中,但是到目前为止,我评测过的性能分析工具主要需要人机交互并且面向UI。

An option I'm considering is writing a separate tool to access MXBean & use it to log such data during the performance tests. 我正在考虑的一个选项是编写一个单独的工具来访问MXBean,并在性能测试期间使用它来记录此类数据。 Just wondering if anything good is around. 只是想知道周围是否有好事。

Please note that this application is running in Tomcat, however for the performance tests we are only using Spring Integration's File endpoints. 请注意,该应用程序正在Tomcat中运行,但是对于性能测试,我们仅使用Spring Integration的File端点。

Please also note, that 'switchable' component within application is also possible solution. 还请注意,应用程序中的“可切换”组件也是可行的解决方案。 However, I'm currently looking for application-agnostic external tools-first solution. 但是,我目前正在寻找与应用程序无关的外部工具优先解决方案。

Command-line tools come to help for this kind of a scenario: 命令行工具可为这种情况提供帮助:

On a Linux/Solaris based environment: 在基于Linux / Solaris的环境中:

  1. Before you run/trigger your JVM for Spring based application, you can run tools like vmstat , sar in a background mode with its output redirected to a flat file - which helps capture CPU, Memory and other such statistics. 在为基于Spring的应用程序运行/触发JVM之前,可以在后台模式下运行vmstatsar等工具,并将其输出重定向到平面文件-这有助于捕获CPU,内存和其他此类统计信息。 Use top with options or mpstat to get thread-level statistics if you seem to be hitting a performance problem, to do bottleneck analysis. 如果您似乎遇到性能问题,请使用带有选项的topmpstat来获取线程级统计信息,以进行瓶颈分析。
  2. Now run the JVM with arguments like printgc , -Xloggc to write JVM verbose output to a flat file or print gc statictics. 现在,使用诸如printgc-Xloggc类的参数运行JVM,以将JVM详细输出写入平面文件或print gc printgc -Xloggc Look under Debugging options section for JVM arguments in Java HotSpot VM Options for more options you need. Java HotSpot VM Options中的 JVM参数的Debugging options部分下查找所需的更多选项。

Tip: create a shell script combining both commands above to run at the same time and achieve your requirement. 提示:结合以上两个命令创建一个Shell脚本,以同时运行并满足您的要求。

On a Windows environment: Windows环境中:

  1. For OS statistics gathering on commandline, you could use typeperf or tracerpt (CSV supported). 对于在命令行上收集操作系统统计信息,可以使用typeperf或tracerpt(支持CSV)。
  2. Now run the JVM with arguments like printgc , -Xloggc to write JVM verbose output to a flat file or print gc statictics. 现在,使用诸如printgc-Xloggc类的参数运行JVM,以将JVM详细输出写入平面文件或print gc printgc -Xloggc Look under Debugging options section for JVM arguments in Java HotSpot VM Options for more options you need. Java HotSpot VM Options中的 JVM参数的Debugging options部分下查找所需的更多选项。

Jmeter is a tool to develop performance and scalability tests (defining http requests and being able to load the server with them) , but also has a plugin to allow for monitoring a target system for system metrics such as CPU utilization, memory utlization etc and also JMX type statistics: Jmeter是用于开发性能和可伸缩性测试(定义http请求并能够将其加载到服务器)的工具,但它具有一个插件,可用于监视目标系统的系统指标,例如CPU利用率,内存利用率等,并且JMX类型统计:

Available JMX metric types: 可用的JMX度量标准类型:

gc-time - time spent in garbage collection, milliseconds (used method) memory-usage - heap memory used by VM, bytes (method used) memory-committed - heap memory committed by VM, bytes (method used) memorypool-usage - heap memory pool usage, bytes (method used) memorypool-committed - heap memory pool committed size, bytes (method used) class-count - loaded class count in VM (used method) compile-time - time spent in compilation, milliseconds (used method)" gc-time-垃圾回收所花费的时间,以毫秒为单位(使用的方法)内存使用情况-VM使用的堆内存,字节(使用的方法)内存已提交-VM提交的堆内存,字节(使用的方法)memorypool-使用情况-堆内存池使用率,字节(使用方法)内存池已承诺-堆内存池已承诺大小,字节(使用方法)类计数-VM中已加载的类计数(使用的方法)编译时间-编译所花费的时间,毫秒(使用的方法) )”

Check http://jmeter-plugins.org/wiki/PerfMonMetrics/ for more details of this plugin. 检查http://jmeter-plugins.org/wiki/PerfMonMetrics/以获取有关此插件的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM