How to measure CPU and memory during load test

23,703

Solution 1

From the java perspective, you can use jconsole or write your own code to monitor the memory usage.

  1. Measure CPU and memory consumption of a Java application
  2. javasysmon on github
  3. dstat for linux and perfmon for windows. Read more

Solution 2

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

Solution 3

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.

Share:
23,703
Thomas
Author by

Thomas

Thomas Zuberbühler | Swiss Expat in Canada | www.geomo.ch Python, Java, JavaScript, TypeScript, C# and more. Passion for maps and spatial applications. Coffee is always appreciated... ;) https://www.buymeacoffee.com/moosetraveller I am mostly just here to answer questions. I think the Stackoverflow system is flawed and questioners are sometimes treated unfriendly, arrogant and unpleasant by some users especially towards non-English speaker. Just because someone earned 10,000 reputation from a beginner's question they asked 10 years ago, it's not ok in my opinion to treat new beginners with disrespect by downvoting and close their question within seconds. I've seen this over and over again. Give beginners a chance!! And accept that not everyone's first language is English and is as good as you to express themselves in a foreign language. Ask for clarification before you downvote or close a question! Also, closing questions because they are supposed to be duplicated (even if they are slightly different) should not be allowed in my opinion. Stackoverflow should rather provide a list of possible duplicated questions. In the FAQ it is even mentioned that a duplicate question can be a signpost for other questions. Maybe this even triggers someone to give an even better or newer answer who would otherwise never came across with this or the duplicated question! Finally, why are outdated answers (old but with a lot of upvotes) favoured over the new ones? Anyways, I am here to help people and when I answer a question, I mostly learn something as well. That said, thank you for asking and helping me to improve my skills. :)

Updated on January 09, 2020

Comments

  • Thomas
    Thomas over 4 years

    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?

    Thank you!

  • Thomas
    Thomas over 13 years
    Thank you!! Great answer! I'm looking currently at jconsole and javasysmon. It would be great if there is a tool which runs as a service and records CPU and memory usage of an application doesn't matter if its a java or native application.
  • zengr
    zengr over 13 years
    I meant, is the OP looking for a "a tool which runs as a service and records CPU and memory usage" for any particular OS?
  • Thomas
    Thomas over 13 years
    if possible. and we are also looking for a tool which capture the usage of the whole computer system while running a load test.
  • Thomas
    Thomas over 13 years
    Thank you. I'll have a look at PerfMon.