Jmeter之性能測試插件PerfMon Metrics Collector監聽器,實時監聽服務器資源(十四)


 

Servers Performance Monitoring

 

Introduction

During a load test, it is important to know the health of the servers loaded. It is also nice to see if you are targeting a cluster if the load is correctly dispatched. To address this, the plugin package now supports server monitoring! Using it, you can monitor CPU, Memory, Swap, Disks I/O and Networks I/O on almost all platforms!

Here is how the plugin looks like. It shows the CPU usage of 4 servers involved in the load test:

Metrics Collected

Since version 0.5.0 the Server Agent tool supports collecting over 75 system metrics. See full list.

How it works

Concept

JMeter cannot retrieve by default server metrics except Tomcat ones. To overcome this situation, we have developed a server agent which will get performance data for JMeter. The agent uses the SIGAR open source library. It is composed of a Java common part and native libraries per OS.

Usage

GUI Mode

In GUI mode, just add the listener, define servers and metric types to monitor, ensure the agent is running at remote server and is not blocked by a firewall, then run the test. The values will be displayed at real time chart.

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.

PerfMon Server Agent

Installation

You do not need any root/admin privilege. You can just unzip the the ServerAgent-X.X.X.zip somewhere on the server. Then launch the agent using startAgent.sh script on Unix, or startAgent.bat script on Windows.

The agent is written in Java, so you will need JRE 1.4+ to run it. Note you can create yourself the agent package which includes its own JRE so you don't have to install java on the server (We tested it on windows platform). To do this, just create a JRE folder in the agent folder and copy one installed JRE inside. Change the java command inside the .bat file to the path to the java executable and it will work.

Once the agent is running, you can use the PerfMon Metrics Collector Listener to connect to the agents. You can add multiple servers to monitor, one graph can display several kinds of metrics (cpu, memory, etc...), auto-zooming rows for best view.

Usage

To start the agent, simply run startAgent bat/sh file. It will open UDP/TCP server ports where JMeter will connect and query the metrics. Some information will be printed to standard output, informing you on problems gathering metrics (logging verbosity regulated with --loglevel parameter).

 

 

 


 

PerfMon Metrics Collector and Server Agent原理和使用可以查看官方文檔

具體可以查看官方的文檔: 
https://jmeter-plugins.org/wiki/PerfMon/

https://jmeter-plugins.org/wiki/PerfMonAgent/ 


下面對環境進行配置:

第一步:https://jmeter-plugins.org/wiki/PerfMonAgent/下載ServerAgent-2.2.1.zip,將ServerAgent-2.2.1.jar上傳到被測服務器,解壓可以直接運行 (Windows環境,雙擊ServerAgent.bat啟動;linux環境執ServerAgent.sh啟動,默認使用4444端口)

 

第二步:https://jmeter-plugins.org/downloads/old/下載JMeterPlugins-Standard-1.4.0.zip和JMeterPlugins-Extras-1.4.0.zip 

PS:jmeter的plugin1.4.0的只支持jmeter3.2以下,不包括3.2!!! 
第三步:然后解壓兩個zip包,把jar文件拷貝到/lib/ext文件夾下,環境配置就完成了。

 

新建測試用的取樣器,並在監聽器選擇jp@gc - PerfMon Metrics Collector和jp@gc - Transactions per Second兩個監聽器,ServerAgent默認是4444端口,也可以修改,比如:./startAgent.sh –udp-port 0 –tcp-port 3450這樣

 

 

 進行加壓的結果


 

在壓測性能過程中,有一點非常非常非常重要:

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.

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.

 

壓測過程中一定要在 NON-GUI模式進行壓測,這也是很多用JM的人經常忽略的地方,如果一個測試人員用JM壓測性能的時候,還使用GUI模式壓測,那么能夠立馬體現你的專業水平很low。

本篇文章只做GUI模式壓測演示,需要查看如何進行NON-GUI模式進行,請查看小七前幾篇文章。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM