转载自:https://www.cnblogs.com/Lam7/p/6833501.html

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.

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

  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.30.50:1099, …, 192.168.30.51:1099,the entry would like like this:
  6. Start JMeter.
  7. Open the test plan you want to use

Start a single clients

  1. Click Run at the top
  2. Select Remote Start
  3. Select the IP address

Start all clients

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

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 trafic 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.

简单点的说

Jmeter分布式执行原理:

  1、Jmeter分布式测试时,选择其中一台作为调度机(master),其它机器做为执行机(slave)。

  2、执行时,master会把脚本发送到每台slave上,slave 拿到脚本后就开始执行,slave执行时不需要启动GUI,我理解它应该是通过命令行模式执行的。

  3、执行完成后,slave会把结果回传给master,master会收集所有slave的信息并汇总。

术语解析

  • master,以GUI模式运行,同时控制测试的运行,在这里就是client,启动脚本所在的那台机器。
  • slave,运行jmeter-server并从master接收指令、向目标服务器发送请求
  • 设置jmeter-server:

    用文本编辑器打开Jmeter/bin目录下的jmeter.properties文件,添加运行jmeter-server的主机IP到remote_hosts

    remote_hosts=192.168.30.50:1099,192.168.30.51:1099,localhost.....

如果你不希望你的客户端也作为jmeter-server运行的话,把localhost从上面的配置中移除。

小白解释分割线

----------------------------------------------------------

再白痴点的解释就是   有 A B C  三台压力机器,属于同一个内网IP

A作为 Master

B跟C两台作为slave

通过A去控制B跟C进行压测服务器
在压测的过程中 需要先开启B跟C的Jmeter的bin目录下的jmeter-server.bat 服务

然后通过A去进行NON-GUI模式去压测,B跟C分布式的压测结果会反馈到A

-----------------------------------------------------------

小白解释结束线

下面进行实战命令 压测

通过 jmeter -l 的帮助命令可以查看到

C:\Users\lamw\Desktop\lamw
λ D:\Jmeter\jmeter-3.1\bin\jmeter -l
Error: Missing argument to option -l
Usage--?print command line options and exit-h, --helpprint usage information and exit-v, --versionprint the version information and exit-p, --propfile <argument>the jmeter property file to use-q, --addprop <argument> additional JMeter property file(s) -t, --testfile <argument> the jmeter test(.jmx) file to run -l, --logfile <argument> the file to log samples to -j, --jmeterlogfile <argument> jmeter run log file (jmeter.log) -n, --nongui run JMeter in nongui mode -s, --server run the JMeter server -H, --proxyHost <argument> Set a proxy server for JMeter to use -P, --proxyPort <argument> Set proxy server port for JMeter to use -N, --nonProxyHosts <argument> Set nonproxy host list (e.g. *.apache.org|localhost) -u, --username <argument> Set username for proxy server that JMeter is to use -a, --password <argument> Set password for proxy server that JMeter is to use -J, --jmeterproperty <argument>=<value> Define additional JMeter properties -G, --globalproperty <argument>=<value> Define Global properties (sent to servers) e.g. -Gport=123 or -Gglobal.properties -D, --systemproperty <argument>=<value> Define additional system properties -S, --systemPropertyFile <argument> additional system property file(s) -L, --loglevel <argument>=<value> [category=]level e.g. jorphan=INFO or jmeter.util=DEBUG -r, --runremote Start remote servers (as defined in remote_hosts) -R, --remotestart <argument> Start these remote servers (overrides remote_hosts) -d, --homedir <argument> the jmeter home directory to use -X, --remoteexit Exit the remote servers at end of test (non-GUI) -g, --reportonly <argument> generate report dashboard only, from a test results file -e, --reportatendofloadtests generate report dashboard after load test -o, --reportoutputfolder <argument> output folder for report dashboard Error: Missing argument to option -l

其中

-r, --runremote

Start remote servers (as defined in remote_hosts)------------------启动远程服务器(如remote_hosts中定义)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)-------------------启动这些远程服务器(覆盖remote_hosts)

那么我们就可以去选择执行所有的配置中的压测机器

D:\Jmeter\jmeter-3.1\bin\jmeter.bat -n -r -t test.jmx -l test.csv -e -o test

可以看到已经成功执行了配置中的2台压测机

PS 如果压测指标是1000并发数,比如我们现在配置了2台需要达到1000并发数,那么就是一台压测并发数500即可

转载于:https://www.cnblogs.com/yuany66/p/10978139.html

Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)(转载)...相关推荐

  1. Jmeter分布式压力测试

    安装 下载地址:http://jmeter.apache.org/download_jmeter.cgi 安装前提(因为jmeter依赖于java所以必须先配置好java) 下载后解压: tar -x ...

  2. Jmeter分布式压力测试全过程(阿里云ECS)

    测试环境搭建 测试脚本生成 非GUI界面测试操作 测试报告 本文主要是总结以下自己学习Jmeter的过程,测试用的接口和测试脚本都很简单. 1.测试环境搭建 首先是测试服务器 因为自己没有可以搭成局域 ...

  3. Jmeter分布式压力测试与优化

    Jmeter非GUI界面参数 -h 帮助 -n 非GUI模式 -t 指定要运行的 JMeter 测试脚本文件 -l 记录结果的文件 每次运行之前,(要确保之前没有运行过,即xxx.jtl不存在,不然报 ...

  4. 【Jmeter基础篇】03:如何进行post接口压力测试

    目前网络上有很多很多Jmeter的压力测试使用指南,但是在实际使用过程中,很多朋友会遇到许多并不处于理想状态的情况,比如某些参数不知道应该往哪里放,具体怎么分析测试结果等等. 所谓压力测试,实质就是让 ...

  5. LVS集群-DR模式及AB压力测试软件的使用方法

    一. LVS-DR和LVS-IP TUN集群概述 1. 服务概述 1.1 Direct Routing(直接路由) director分配请求到不同的real server.real server处理请 ...

  6. jmeter非GUI模式如何压测并生成测试报告

    在启动Jmeter时,我们会看到这样一句提示: 不要使用GUI模式(界面模式)进行负载测试,GUI模式只能用于创建测试和调试.进行负载测试时,需要时用非GUI模式. 那么为什么进行负载测试时一定要用非 ...

  7. 性能测试 性能测试实战(八)Jmeter性能测试平台开发,性能测试平台架构解析 ,性能测试平台搭建 分布式性能压测平台 Jmeter分布式性能测试管理平台 性能测试平台示例案例 《完结篇》

    文章目录 一.前言 二.Jmeter分布式性能测试平台 介绍 1.Jmter分布式性能测试平台 简介 2.Jmeter分布式性能测试平台 优秀案例1 3.Jmeter分布式性能测试平台 优秀案例2 4 ...

  8. Jmeter性能测试实战教程系列-搭建分布式性能测试环境(五)

    Jmeter 是java 应用,对于CPU和内存的消耗比较大,因此,当需要模拟数以千计的并发用户时,使用单台机器模拟所有的并发用户就有些力不从心,甚至会引起JAVA内存溢出错误.为了让jmeter工具 ...

  9. 基于 jmeter 的分布式性能测试实战

    最近作者在公司部署公司的分布式压力测试情况的时候,遇到了问题,什么问题呢,各种错误,于是大晚上的为了不耽误压测,我们就两个同事两台电脑搞,可是还是不行的呢,我要研究研究这个是什么梗,于是乎,大晚上加班 ...

最新文章

  1. CO-类的本质、description方法
  2. 《Orange’s 一个操作系统的实现》3.保护模式1----pm.inc分析
  3. [渝粤教育] 西南科技大学 高速公路 在线考试复习资料
  4. SSM:web目录下有的jsp和图片不能显示,有的可以显示的解决方法
  5. 想怎么GAN就怎么GAN,一键拯救发际线
  6. java学习笔记(十一)常用类、反射、垃圾回收
  7. 【CodeForces】741 D. Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths(dsu on tree)
  8. ThreadLocal原理、ThreadLocal内存泄漏
  9. win7注册服务器错误代码,win7系统启动不了iis服务器出现错误代码怎么解决
  10. 如何关闭电脑弹窗(2种方法)
  11. matlab凸优化工具箱——cvx简介
  12. HTTP接口的请求参数类型有哪些
  13. golang 支付宝小程序 登陆
  14. linux就是这个范儿之特种文件系统(1)
  15. 计算机如何操作补考,关于计算机Excel补考试题
  16. RabbitMQ高级特性-惰性队列
  17. java——Java环境搭建:JDK安装、常用命令
  18. Springboot整合SpringSecurity 04-启用登出logout功能
  19. 电路图部分原件的画法
  20. 关于栈迁移的那些事儿

热门文章

  1. Linux命令之whereis
  2. php 超过100m文件上传,科技常识:apache+php上传大文件以上传100M为例
  3. Javascript 进阶 作用域 作用域链
  4. Struts2 action之间相互跳转传递参数
  5. js如何获取文本节点的值?
  6. 备忘录方法与动态规划比较
  7. 动态规划 RQNOJ 吃西瓜 最大子段和三维版
  8. 系统程序员成长计划-组合的威力
  9. ubuntu通过pem连接服务器
  10. STM32用keil5调试程序出现 Error:Flash Download Failed-Cortex-M3解决方案