sa003

JMeter – Server Performance Metrics Collector

JMeter has many listeners which provide useful information like

  • Number of the requests processed
  • Average response time
  • Throughput
  • 90% line
  • Error %   etc

But….What about the server performance metrics? like CPU / Memory utilization.

JMeter is not only generating the load on the server but also comes with an agent which can run on the server machine to collect the server performance metrics.

In this article, lets see how the Server Performance Metrics Collector works.


Install Server Agent:

 

For JMeter Version V2.13 or below

  1. Download the latest server agent from JMeter-Plugins.
  2. Unzip this file. Place the entire folder in some location on the server.
  3. Server should have Java JRE to run this server agent.
    • Install Java Runtime Engine.
    • Java bin should be included in the PATH (environment variables)
  4. You need to open the port 4444 (default) on the server machine.
  5. Start the startAgent.bat/startAgent.sh
    • startAgent.bat –tcp-port 5555 (if you need to use different port, pass the port as argument).

It would be very simple if the server machine has Java already. The agent has started running at this point.

PerfMon Metrics Collector:

To listen to the agent running on the server, JMeter has a separate listener called – PerfMon Metrics Collector. It is available as part of jmeter-plugins Standard Set. We also have a Plugin Manager for JMeter for easy plugin installation.

 

  1. Download the latest standard set from jmeter-plugins.
  2. Unzip the file content. Copy the lib folder  & paste it under JMETER_HOME.
  3. Restart JMeter
  4. Now you should see jp@gc – PerfMon Metrics Collector under Listeners.

 

OR

  1. Use Plugin Manager to install PerfMon plugin which is responsible for collecting the metrics.

 

That’s it. Lets try this set up.

Test the Agent & Metrics collector:

  • I have a tomcat server running in my machine on the port 8080.
  • I created a simple JMeter test to generate some load on the tomcat server. [I know it is not good idea to run the server & load generator on the same machine. But our aim here is to see how it works]
  • Server agent is running on the port 4444.

JMeter Test:

sa001

 

Listener:

sa002

 

  • Host/IP –> Host or IP address of the system where the agent runs.
  • Port –> Port through which listener can talk to server agent.
  • Metric to Collect –> CPU, Memory, Disks I/O…etc  [It is a drop down. Select the metric you are interested in]
  • Metric Parameter –> Specific parameter in case of any for the Metric. [For ex: I was interested in collecting only the free memory while running the load test]
    • If you need to collect the metric for a specific process, update the process ID. For ex: pid=4008

Now everything is ready to test! Start the JMeter test.

CPU Utilization %:

During my test on the tomcat server, the CPU utilization of the server machine was as given below – for 20 users, the machine started using 100% of CPU.

Next time you do your load testing, other than Response Time, Median, Throughput etc,  start measuring Memory & CPU utilization as well with JMeter listeners.

sa003

 

Non-GUI Mode:

If you run JMeter in non GUI mode and want to save monitoring data to file, just configure result file saving in GUI as you do with other listeners. After running the test you may load saved file into GUI and see the values timeline. For more details, please visit.

 

InfluxDB + Grafana:

If you would like to use InfluxDB + Grafana dashboard for these metrics, please check this article.

 

 

Happy Testing & Subscribe 🙂

 


Share This:

Categories: Articles, Best Practices, CI / CD / DevOps, Framework, JMeter, Monitoring, Report

17 comments

  • jagadeesh

    I want to measure CPU and Memory usage of my server during load test using Jmeter. For this i added “jp@gc – PerfMon Metrics Collector” listener with my scripts in jmeter GUI and configured jmeter perfmon plugin in my server. I got the graph in jmeter GUI correctly without any errors.

    Now i want to run my same jmeter script via Maven and jenkins for continuous Integration (Without opening jmeter GUI).

    My question is, How can i see the CPU and memory usage of the server in graph without opening jmeter GUI after test execution completes.

    Is it possible to generate CPU and Memory graph once my test script completes execution in Jenkins? If so please guide me how to do this.
    And also please let me know if any plugin needs to be added in my pom.xml file inorder to get CPU and Memory usage graph.

  • yash

    Sorry for my ignorance… but I am unable to find the Home folder in Jmeter, where I need to paste the lib folder copied from Jmeter Plugins file. Please assist me on that..

    • vIns

      Home is folder where the JMeter’s bin and lib folders etc are present.

      Lets say you open jmeter using the .bat file in this path => in c:\dummy\folder2\jmeter2.11\bin\jmeter.bat

      c:\dummy\folder2\jmeter2.11 is the JMeter Home folder.

      Place the jars you downloaded under lib folder (c:\dummy\folder2\jmeter2.11\lib).

  • havy

    Sorry for my ignorance… but I am not perform the following steps:
    3. Server should have Java JRE to run this server agent.
    Install Java Runtime Engine.
    Java bin should be included in the PATH (environment variables)
    Help me, thanks you!

  • Sumit

    Hi All,

    I am able to get the graph using perfmon, and now is it possible to get the raw data from where the graph is being generated?

    • vIns

      Yes, Check the ‘Non GUI’ mode section of this post. Basically, you add the listener & configure the path to store the raw data to see the graph later.

    • vIns

      You need to add the listener and update the listener to write the metrics in a file when you run the test in non-gui mode. The command is simple.

      jmeter -n -t test.jmx

Leave a Reply

Your email address will not be published. Required fields are marked *