Java 如何在负载测试期间测量 CPU 和内存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4192722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 14:25:29  来源:igfitidea点击:

How to measure CPU and memory during load test

javatestingjmeterload-testingwebapplicationstresstool

提问by Thomas Zuberbühler

We are using JMeter in a heterogeneous environment and we would like to measure CPU and memory while we are producing heavy load on a server where our service or web application is running. What would you recommend to use? Is there any software solution (open source or commercial) available which records CPU and memory usage in a file or to a database?

我们在异构环境中使用 JMeter,当我们在运行服务或 Web 应用程序的服务器上产生大量负载时,我们希望测量 CPU 和内存。你会推荐使用什么?是否有任何软件解决方案(开源或商业)可以在文件或数据库中记录 CPU 和内存使用情况?

Thank you!

谢谢!

采纳答案by zengr

From the java perspective, you can use jconsoleor write your own codeto monitor the memory usage.

从java的角度,可以使用jconsole或者自己编写代码来监控内存使用情况。

  1. Measure CPU and memory consumption of a Java application
  2. javasysmonon github
  3. dstatfor linux and perfmon for windows. Read more
  1. 测量 Java 应用程序的 CPU 和内存消耗
  2. github 上的 javasysmon
  3. dstatfor linux 和 perfmon for windows。阅读更多

回答by Stephane

You can use our JMeter perfmon pluginto measure CPU, memory and a lot of other metrics:

您可以使用我们的 JMeter perfmon 插件来测量 CPU、内存和许多其他指标

回答by liulinyang

You could take a look at Cacti.

你可以看看仙人掌

It could collect resource usages like CPU, MEM easily with built-in templates and display them in nice graphics. Both Windows and Uni* are supported.

它可以使用内置模板轻松收集 CPU、MEM 等资源使用情况,并以漂亮的图形显示它们。支持 Windows 和 Uni*。

回答by user2981810

One you install the Perfmon plugin, I also had to install the server agent, and open the firewall port 4444.

一个你安装Perfmon插件,我还得安装服务器代理,并打开防火墙端口4444。

Here's a link which I found super useful.

这是我发现非常有用的链接。

http://grosan.co.uk/web-application-performance-testing-using-apache-jmeter-part-2-monitor-server-resources/

http://grosan.co.uk/web-application-performance-testing-using-apache-jmeter-part-2-monitor-server-resources/

回答by alphamikevictor

Perhaps you can take a look to collectdif you run in some unix/linux flavour. It will bring you not only CPU but also memory, Disk IO, network and a good number of plugins available.

如果您以某种 unix/linux 风格运行,也许您可以看看collectd。它不仅会给你带来 CPU,还会给你带来内存、磁盘 IO、网络和大量可用的插件。