Jmeter stress test on udp interface

1. Download JMeter 

http://jmeter.apache.org/download_jmeter.cgi

 

2. Download the plugin 

https://jmeter-plugins.org/downloads/all/

Download plugins-manager.jar and put it into lib/ext directory, then restart JMeter.

Just put this file in the apache-jmeter/lib/ext directory

 

3. JMeter3 add UDP plugin

Start JMeter, options - plugins-manager - Available plugins - UDP Protocol Support

 

4. JMeter2 adds UDP plugin

Note that if it is JDK 6, you can only use Jmeter2, and download the following three packages

JMeterPlugins-ExtrasLibs-1.1.3.zip,

JMeterPlugins-Extras-1.1.3.zip,

JMeterPlugins-Standard-1.1.3.zip

.Overwrite the lib folder in the above three compressed packages to the lib folder in the jmeter directory

 

 5. Content in the Data Encode/Decode class in jp@gc-UDP Request

You can choose the following three

 

Full Class Name Comments  
kg.apc.jmeter.samplers.HexStringUDPDecoder This is most useful implementation, converts data from/to HEX-encoded sequences. For example, 6a6d6574657220706c7567696e73 corresponds to jmeter plugins.  
kg.apc.jmeter.samplers.DNSJavaDecoder This implementation requires Extras With Libs Set to be installed. Request data must contain three fields, separated with spaces: name, type, class. Example: www.com. A IN. Response data converted to text using DNSJava. Request flags can be set using +/- integer value on new line, eg 7 sets reqursion desired flag.  
kg.apc.jmeter.samplers.UDPSampler This implementation used as default when no valid class name specified in GUI. It makes no conversion on data.  

 I use kg.apc.jmeter.samplers.UDPSampler

 

 

6. The result is garbled

选择处理器按右键,选添加-后置处理器-BeanShell PostProcessor,script中填入

 

prev.setDataEncoding("UTF-8");

 

 

7.非GUI模式压测 

将压测用例保存到bin目录下 *.jmx文件,./jmeter.sh -n -t mytest.jmx -l mytest.jtl

 

8.参看*.jtl结果

随便找个地方新建聚合报告,选择文件处选择目标JTL文件

 

9.建议

第一次压测的时候可以考虑添加断言,1个线程跑几次的方式测试返回结果是否正确,因为通过添加“观察结果树”选择*.jtl文件,结果也是空的。不能排除有返回但结果不是预期的情况。

压测与内存和CPU均有关系,压测时需要注意线程数,有文献指出服务器端线程数应为CPU核数+1。压测端可以在线程组中设置Ramp-Up Period(in seconds) 全部线程启动完成时间和调度器设置中的持续时间,将两个时间拉长,基本可以从输出中观察到线程与tps的关系。

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326641034&siteId=291194637