jmeter:分布式注意事项

分布式
  特点
    解决单台压力不够问题
    解决单台机器的网络瓶颈
    解决单台机器压测线程数的限制
      官方提示: 2-3Ghz CPU (recent cpu) can handle 1000-2000
  注意点
    master的资源要监控
    相同的jmeter版本
    相同的jdk版本
    防火墙、杀毒软件关闭
      反病毒应该在负载测试期间停止,因为它会严重影响计时,导致错误的结果。
    同一个子网
    测试计划.jmx不要拷贝到Slaves机器上
    测试数据,如CSV数据需要拷贝到Slaves机器上,必须使用跟master相同的绝对路径
    测试结果保存文件只会保存在master机器上

    所有负载机是均分的,设置并发线程时是平均值,而不是总是,如压测目标是2000,有4台压测机,则线程配置成500


官网链接:http://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html

25. Apache JMeter Distributed Testing Step-by-step

This short tutorial explains how to use multiple systems to perform stress testing. Before we start, there are a couple of things to check.

  • the firewalls on the systems are turned off or correct ports are opened.
  • all the clients are on the same subnet.
  • the server is in the same subnet, if 192.x.x.x or 10.x.x.x IP addresses are used. If the server doesn't use 192.xx or 10.xx IP address, there shouldn't be any problems.
  • Make sure JMeter can access the server.
  • Make sure you use the same version of JMeter and Java on all the systems. Mixing versions will not work correctly.

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 master controller initiates the test on multiple slave systems.

In this tutorial we use GUI Mode just for demonstration. In real life you should use NON GUI mode to start your load test
One master controls multiple slavesOne master controls multiple slaves

25.1 Terminology

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.

Master
the system running JMeter GUI, which controls the test
Slave
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 systemsCategories of systems

25.2 Step-by-Step

  1. On the slave systems, go to jmeter/bin directory and execute jmeter-server.bat (jmeter-server on unix).
  2. On master system acting as the console, open windows explorer and go to jmeter/bin directory
  3. Open jmeter.properties in a text editor
  4. Edit the line remote_hosts=127.0.0.1
  5. Add the IP address. For example, if I have JMeter server running on 192.168.0.10, …,192.168.0.15, the entry would like like this:
    remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
  6. Start JMeter.
  7. Open the test plan you want to use
Simple test planSimple test plan

25.2 Starting the Test

At this point, you are ready to start load testing. If you want to double check the slave systems 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.

25.3 Start a single clients

  1. Click Run at the top
  2. Select Remote Start
  3. Select the IP address
Start a single slaveStart a single slave

25.4 Start all clients

  1. Click Run at the top
  2. Select Remote Start all or use Ctrl + Shift + R
Start all slavesStart all slaves

25.5 Limitations

There are some basic limitations for distributed testing. Here's the list of the known items in no specific order.

  1. RMI cannot communicate across subnets without a proxy; therefore neither can JMeter without a proxy.
  2. Since version 2.9, JMeter sends all the test results stripping Response data to the controlling console, this allows us to reduce impact on network IO. Ensure you monitor your network traffic so that this traffic does not incur contention
  3. A single JMeter client running on a 2-3 GHz CPU (recent CPU) can handle 1000-2000 threads depending on the type of test.

25.7 Tips

In some cases, the firewall may still be blocking RMI traffic.

Anti Virus and Firewall

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.

  1. Open control panel
  2. Open administrative tools
  3. Double click services
  4. Go to down to Symantec anti virus, right click and select stop

Windows firewall

  1. Open network connections
  2. Select the network connection
  3. Right click and select properties
  4. Select advanced tab
  5. Uncheck internet connection firewall

Linux

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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值