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, --help
print usage information and exit
-v, --version
print 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即可

Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)的更多相关文章

  1. Jmeter之http性能测试实战 非GUI模式压测 NON-GUI模式 结果解析TPS——干货(十一)

    性能测试计划 性能测试用例 录制脚本 性能测试结果 性能测试报告 性能测试监控报告 准备工作 从脚本已录制成功之后开始进行压测 安装Jmeter拓展插件 查看 Transactions per Sec ...

  2. Jmeter性能测试-分布式压力测试

    作为一个测试行业的菜鸟,由于投身于一个小公司,包揽所有的测试.刚开始的功能测试到接口测试,稳定性测试,兼容性测试等,一般由于是小项目所以对于性能有所忽略,也没怎么涉及,公司接了个大项目,后期对于性能上 ...

  3. 性能测试工具 jmeter 分布式压力测试实操

    性能测试工具 jmeter 分布式压力测试实操 本文在Non-GUI Mode下进行,准备好三台有jdk环境,linux操作系统,同一局域网测试机器,运行两台slave,一台master机器,进行分布 ...

  4. jmeter分布式压力测试实践+登录为例

    1.一张分布式压力的图解,如下 准备: 1.两台slave 2.一个master 3.待测目标地址 http://XXX 准备环境:linux环境,master如果可以最好有可视化电脑界面,便于jmx ...

  5. 桥接模式 桥梁模式 bridge 结构型 设计模式(十二)

      桥接模式Bridge   Bridge 意为桥梁,桥接模式的作用就像桥梁一样,用于把两件事物连接起来   意图 将抽象部分与他的实现部分进行分离,使得他们都可以独立的发展.  意图解析 依赖倒置原 ...

  6. 『动善时』JMeter基础 — 55、使用非GUI模式运行JMeter(命令行模式)

    目录 1.JMeter的非GUI模式说明 2.为什么使用非GUI模式运行JMeter 3.使用非GUI模式运行JMeter (1)非GUI模式运行JMeter步骤 (2)其它参数说明 4.CLI模式运 ...

  7. 【转】Jmeter分布式压力测试

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

  8. linux上实现jmeter分布式压力测试(转)

    摘要:最近根据公司工作的需求,学习了一些压力测试的知识,目前,公司使用的是jmeter进行压力测试.下面就记录下近期的学习.我想将这次的博文分成三个部分:1.开始测试前的准备(测试环境的搭建)2.在一 ...

  9. Jmeter 分布式压力测试

      JMeter中进行分布式测试 作为一个纯 JAVA 的GUI应用,JMeter对于CPU和内存的消耗还是很惊人的,所以当需要模拟数以千计的并发用户时,使用单台机器模拟所有的并发用户就有些力不从心, ...

随机推荐

  1. js和native交互方法浅析

    一.背景 最近接触公司项目,需要和原生app做交互,由此业务需求,开始了学习探索之路. 二.解决方案之WebViewJavascriptBridge 想要和app交互,必须在app上先把bridge进 ...

  2. Java源码解读(一) 8种基本类型对应的封装类型

    说起源码其实第一个要看的应该是我们的父类Object,这里就不对它进行描述了大家各自对其进行阅读即可. 一.八种基本类型 接下来介绍我们的八种基本类型(这个大家都知道吧):char.byte.shor ...

  3. kafka快速入门(官方文档)

    第1步:下载代码 下载 1.0.0版本并解压缩. > tar -xzf kafka_2.11-1.0.0.tgz > cd kafka_2.11-1.0.0 第2步:启动服务器 Kafka ...

  4. 【JavaScript函数】

    函数的定义 : [完成某一个功能的代码段] 1.方便维护 2.重复利用 3.执行代码段 函数的一些要求: function 定义某一个函数 命名最好要有语义化, 函数名称最好是驼峰, 严格区分大小写, ...

  5. CodeForces731-C.Socks-并查集

    C. Socks time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp ...

  6. RMQ算法

    1. 概述 RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A ...

  7. Legal or Not(拓扑排序判环)

    http://acm.hdu.edu.cn/showproblem.php?pid=3342 Legal or Not Time Limit: 2000/1000 MS (Java/Others)   ...

  8. c++(递归和堆栈)

    看过我前面博客的朋友都清楚,函数调用主要依靠ebp和esp的堆栈互动来实现的.那么递归呢,最主要的特色就是函数自己调用自己.如果一个函数调用的是自己本身,那么这个函数就是递归函数. 我们可以看一下普通 ...

  9. [国嵌攻略][108][Linux内核链表]

    链表简介 链表是一种常见的数据结构,它通过指针将一系列数据节点连接成一条数据链.相对于数组,链表具有更好的动态性,建立链表时无需预先知道数据总量,可以随机分配空间,可以高效地在链表中的任意位置实时插入 ...

  10. .30-浅析webpack源码之doResolve事件流(1)

    这里所有的插件都对应着一个小功能,画个图整理下目前流程: 上节是从ParsePlugin中出来,对'./input.js'入口文件的路径做了处理,返回如下: ParsePlugin.prototype ...