Web Application Performance Testing using Apache JMeter, Part 2: Monitor Server Resources

In Part 1 of Web Application Performance Testing using Apache JMeter I wrote about how to install Apache JMeter and create a test. In this part I am writing about how to monitor server resources, using the PerfMonAgent Server Agent and the PerfMon Metrics Collector Listener plugin. These are particularly useful when trying to measure the impact over your server during perfomance tests. 

PerfMonAgent Server Agent is a tool written in Java, that resides on the target server. It collects statistics about CPU, Memory, Swap, Disks I/O and Networks I/O, supporting a wide range of operating systems. In this example, the target server operating system is CentOS Linux.

Below are the steps to follow for installing and configuring the Server Agent.

NOTES: The process assumes Java and 'wget' are already available. No root privileges are required, except for firewall changes.

  1. Download and extract the agent:
    wget http://jmeter-plugins.googlecode.com/files/ServerAgent-2.2.1.zip
    unzip ServerAgent-2.2.1.zip
  2. Start the agent. By default, the listening TCP/UDP ports are 4444:
  3. If your server is behind a firewall, enable connections on TCP/UDP ports 4444, by appending the following rules to '/etc/sysconfig/iptables':
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 4444 -j ACCEPT
    -A INPUT -m state --state NEW -m udp -p udp --dport 4444 -j ACCEPT

    Followed by a firewall restart:

    /etc/init.d/iptables restart

Once the Server Agent is ready, you can configure the PerfMon plugin to connect to it. The following example relies on a test created in the previous part of this article:

  1. Right click 'HTTP Request', and select 'Add'->'Listener'->'jp@gc – PerfMon Metrics Collector'
  2. Select the new listener and configure it to keep track of CPU, Memory and Disks I/O reads statistics, by clicking 'Add Row' and changing the 'Host / IP' and 'Port' values to point to the Server Agent IP Address and port; and setting the 'Metric to collect'. Each metric accepts a number of parameters, which can be configured in the last column of each row:Servers To Monitor
  3. Start the test, and monitor resource usage:

How to read the above chart: The X Axis specifies the time (since the test started) at which statistics were collected, the Y Axis indicates resource usage, in percentage. In this example, at the the beginning of the test CPU usage was 32%, Disk I/O reads 0% and Memory usage 62%. 


With the use of PerfMonAgent Server Agent and PerfMon Metrics Collector you can now monitor the behaviour of your server. Depending on the number of metrics and parameters, these tools can cover: CPU, Memory, Swap, Disks I/O and Networks I/O.

4 thoughts on “Web Application Performance Testing using Apache JMeter, Part 2: Monitor Server Resources”

  1. I want to measure CPU and memory usage of my server during load test.
    For this i added “jp@gc – PerfMon Metrics Collector” listner 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 jmeter script via Maven and jenkins for continous Integrtaion (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.
    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.

  2. I need to integrate the above into Maven (preferably Jenkins-Maven). Is there an option to do that. When I tried running with Maven through POM and using “jmeter-analysis-maven-plugin” from com.lazerycode.jmeter, the Perfmon plug-in is not generating any output files.

    1. Hi Richard,

      I am stuck into same issue which you have mentioned. Did you find a solution for non gui mode through jmeter analysis maven plugin. ?

Leave a Reply

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