This short tutorial explains how to use multiple systems to perform stress testing. Before we start, there are a couple of things to check.
Once you've made sure the systems are ready, it's time to setup remote testing. The tutorial assumes you already have JMeter installed on all the systems. The way JMeter works is one controller node initiates the test on multiple worker nodes.
In this tutorial we use GUI Mode just for demonstration. In real life you should use CLI mode (NON GUI) to start your load test
One controller node with multiple worker nodes
Before we dive into the step-by-step instructions, it's a good idea to define the terms and make sure the definition is clear.
Controller Node
the system running JMeter GUI, which controls the test
Worker Node
the system running jmeter-server, which takes commands from the GUI and send requests to the target system(s)
Target
the webserver we plan to stress test
Categories of systems
remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
Simple test plan
At this point, you are ready to start load testing. If you want to double check the worker nodes are working, open jmeter.log in your editor. You should see the following in the log.
Writing log file to: /XXXX/XXXXX/bin/jmeter-server.log Created remote object: UnicastServerRef [liveRef: [endpoint:[192.X.X.X:XXXXX](local),objID:[-6a665beb:15a2c8b9419:-7fff, 3180474504933847586]]]
If you do not see this message, it means jmeter-server did not start correctly. For tips on debugging the issue, go to the tips section. There are two ways to initiate the test: a single system and all systems.
Start a single worker node
Start all worker nodes
There are some basic limitations for distributed testing. Here's the list of the known items in no specific order.
Wiki page on remote testing
Remote Testing in the user manual
In some cases, the firewall may still be blocking RMI traffic.
Antivirus should be stopped during a Load Test as it can drastically impact timings leading to wrong results.
Firewall needs to be stopped from windows services or at least some ports need to be opened.
On Linux, iptables might be turned on by default. For instructions, please refer to the Remote Testing in the user manual
On RedHat (or derivatives), iptables is turned on by default. Execute
service iptables stop
to stop the Linux firewall or ensure you open the correct ports.
中文总结:
系统准备:检查防火墙是否关闭或开放了正确端口,确保客户端和服务器在同一子网,JMeter和Java版本一致,配置或禁用SSL for RMI。
分布式测试:使用一个控制节点(运行JMeter GUI)来启动和管理多个工作节点(运行jmeter-server)的测试。
术语定义:
控制节点:运行JMeter GUI,负责控制测试。
工作节点:运行jmeter-server,执行实际的测试任务。
目标:被测试的服务器。
工作节点启动:在每个工作节点上运行jmeter-server.bat(Windows)或jmeter-server(Unix)。
控制节点配置:编辑jmeter.properties,在remote_hosts中添加工作节点的IP地址。
开始测试:在JMeter GUI中打开测试计划,选择“Remote Start”来启动单个或所有工作节点的测试。
日志检查:检查jmeter.log以确保工作节点正常启动。
限制:RMI(因此也是JMeter)无法在没有代理的情况下跨子网通信;JMeter 2.9及以后版本优化了网络I/O,通过不传输响应数据来控制网络负载。
性能:一台2-3 GHz的单个JMeter客户端可以处理1000-2000线程,性能受测试类型影响。
安全与防火墙:进行负载测试时,建议暂停反病毒软件,确保防火墙不干扰RMI通信,可能需要手动配置或关闭防火墙。