jmeter-00 JMeter 运行过程
一.GUI mode 图形化界面运行
to run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file. These files are found in the bin directory.
windows中,bin目录下可用脚本有:
jmeter.bat
run JMeter (in GUI mode by default)
jmeterw.cmd
run JMeter without the windows shell console (in GUI mode by default)
jmeter-n.cmd
drop a JMX file on this to run a non-GUI test
jmeter-n-r.cmd
drop a JMX file on this to run a non-GUI test remotely
jmeter-t.cmd
drop a JMX file on this to load it in GUI mode
jmeter-server.bat
start JMeter in server mode
mirror-server.cmd
runs the JMeter Mirror Server in non-GUI mode
shutdown.cmd
Run the Shutdown client to stop a non-GUI instance gracefully
stoptest.cmd
Run the Shutdown client to stop a non-GUI instance abruptly
Linux/Unix 中,bin目录下可用脚本有:
jmeter
run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.
jmeter-server
start JMeter in server mode (calls jmeter script with appropriate parameters)
jmeter.sh
very basic JMeter script (You may need to adapt JVM options like memory settings).
mirror-server.sh
runs the JMeter Mirror Server in non-GUI mode
shutdown.sh
Run the Shutdown client to stop a non-GUI instance gracefully
stoptest.sh
Run the Shutdown client to stop a non-GUI instance abruptly
二.Non-GUI mode( Command-line mode) 非图形化界面运行
For load testing, you must run JMeter in this mode
命令选项有:
D:\apache-jmeter-3.3\bin>jmeter -?
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \
/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |
/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 3.3 r1808647 Copyright (c) - The Apache Software Foundation --?
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. "-t LAST" will load last
used file
-l, --logfile <argument>
the file to log samples to
-i, --jmeterlogconf <argument>
jmeter logging configuration file (log4j2.xml)
-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=
or -Gglobal.properties
-D, --systemproperty <argument>=<value>
Define additional system properties
-S, --systemPropertyFile <argument>
additional system property file(s)
-f, --forceDeleteResultFile
force delete existing results files before start the test
-L, --loglevel <argument>=<value>
[category=]level e.g. jorphan=INFO, jmeter.util=DEBUG or com
.example.foo=WARN
-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
举例:
jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P
GUI mode should only be used for creating the test script, NON GUI mode must be used for load testing
三、分布式运行
(1)控制机:也可以参与脚本的运行,同时它也担负着管理远程负载机指挥远程负载机运行的任务,并且收集远程负载机的测试结果。
(2)负载机:向被测应用服务器发起负载的机器。负载机首先要启动一个客户端程序(Agent:jmeter-server.bat),这样控制机才能接管负载机。控制机会把运行的脚本隐蔽地发送到远程负载机,但是如果运行的测试脚本有参数文件及依赖的jar包时,控制机并不能把它们发送到远程负载机,这种情况就需要手动拷贝了。
(3)远程运行逻辑:
远程负载机首先启动Agent程序,待控制机连接;
控制机连接上远程负载机;
控制机发送指令(脚本及启动命令)启动线程;
负载机运行脚本,回传状态(包括测试结果)
控制机收集结果并显示。
举例:在10.1.102.68 机器中启动jmeter 作为控制机,在10.1.102.75 机器中启动jmeter作为负载机。
方式一:控制机以GUI方式运行
1.首先在68 jmeter 的jmeter.properties 中指定"remote_hosts" (修改了jmeter.properties 文件需要重新启动JMeter才可以生效)
# Remote Hosts - comma delimited
remote_hosts=10.1.102.75
#remote_hosts=localhost:1099,localhost:2010
2.在75 中,启动JMeter Agent 程序,如

3. 在68中,启动jmeter,做一个简单配置,如下:

点击远程全部启动
即可。
此时如果正常运行,则75中的agent 控制台中输出如下:

方式二:控制机通过非GUI方式运行
1. 配置测试计划

2. 在75 中,启动JMeter Agent 程序,如

3. 在68中, 命令行执行如下:
D:\apache-jmeter-3.3\bin>jmeter -n -t F:\jmeter_workspace\测试计划-远程运行实例.jmx -l F:\jmeter_workspace\remote.jtl -R 10.1.102.75
Creating summariser <summary>
Created the tree successfully using F:\jmeter_workspace\测试计划-远程运行实例.jmx
Configuring remote engine: 10.1.102.75
Starting remote engines
Starting the test @ Fri Nov :: CST ()
Remote engines have been started
Waiting for possible Shutdown/StopTestNow/Heapdump message on port
此时如果正常运行,则75中的agent 控制台中输出如下:

四、通过命令行覆盖属性配置
Java system properties and JMeter properties can be overridden directly on the command lin (instead of modifying jmeter.properties). To do so, use the following options:
-D[prop_name]=[value]
defines a java system property value.
-J[prop_name]=[value]
defines a local JMeter property.
-G[prop_name]=[value]
defines a JMeter property to be sent to all remote servers.
-G[propertyfile]
defines a file containing JMeter properties to be sent to all remote servers.
-L[category]=[priority]
overrides a logging setting, setting a particular category to the given priority level
举例:
jmeter -Duser.dir=/home/mstover/jmeter_stuff -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG
实例:从命令行中,指定运行线程数与url


命令行执行命令:
jmeter -n -t "mock_api .jmx" -JthreadCount= -Durl=10.1.102.75
五、命令行选项与properties配置的处理顺序
- -p propfile
- jmeter.properties (or the file from the -p option) is then loaded
- -j logfile
- Logging is initialised
- user.properties is loaded
- system.properties is loaded
- all other command-line options are processed

***微信扫一扫,关注“python测试开发圈”,了解更多测试教程!***
jmeter-00 JMeter 运行过程的更多相关文章
- Jmeter运行过程中如何让Fiddler同时可以抓获到服务器的应答报文
在默认情况下,Jmeter运行过程中,Fiddler是抓不到对应的应答报文的. 但是,在某些时候,我们希望分析Jmeter执行失败的原因,想了解Jmeter获取到的应答报文是否有问题,就需要同服务器返 ...
- jmeter命令行运行-分布式测试
上一篇文章我们说到了jmeter命令行运行但是是单节点下的, jmeter底层用java开发,耗内存.cpu,如果项目要求大并发去压测服务端的话,jmeter单节点难以完成大并发的请求,这时就需要对j ...
- 记录Jmeter集成Jenkins运行Ant做接口监听
最近在鼓捣Jmeter的接口测试,把他集成到了Jenkins上做自动化接口监听.把操作记录下来. 首先就是进行接口测试的编写.打开Jmeter.主要是把接口的测试逻辑和断言处理调通后就OK了,接口程序 ...
- JMeter安装+配置+运行
环境配置: 操作系统:Win7系统 jdk版本:1.8 JMeter版本:3.0 一 JMeter的安装配置过程 JMeter是100%纯java应用程序,它在任何支持完整java实现的系统上都能正 ...
- Jmeter非GUI运行,生成html报告
一.JMete执行方式 JMeter执行方式有2种,一种是GUI模式,一种是非GUI模式.GUI模式就是界面模式,非GUI模式就是命令行模式.界面模式主要用来编写和调试脚本用的,项目的真正执行最好是采 ...
- jmeter的基本使用过程
jmeter的基本使用过程 接下来几周,我将通过视频的方式,录制下来jmeter的基本用法,方便大家参考学习 可能导图会随时调整
- Jmeter命令行运行配置环境变量
Jmeter命令行运行配置环境变量 在打开jmeter GUI界面时会弹出cmd命令窗口提示:压测时不要用GUI,要用命令行 在cmd命令行里面运行jmeter的话,需要配置jmeter环境变量,下面 ...
- JMeter (3) —— JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial)
JMeter (3) -- JMeter录制脚本并压力测试用户登陆场景以CAS SSO为例(101 Tutorial) 主要内容 JMeter录制脚本并进行压力测试用户登陆场景,并以CAS SSO单点 ...
- JMeter接口测试-JMeter+ant实现接口自动化测试
前言 小伙伴们,用python做接口自动化是不是写代码比较繁琐,而且没有python代码基础的小伙伴根本无从下手对吧!今天我们来学习一下如何使用JMeter工具实现接口自动化测试. 1.安装JDK,配 ...
随机推荐
- 八、网页版消息推送SDK-WebSockets
介绍 由于项目组需求.最近在研究消息推送服务平台.结合业务和使用场景分析最终选择的是 Mosquitto 消息服务器. Mosquitto 服务器的安装.配置.集群搭建 我就不在这多说了.有兴趣的可以 ...
- 工作笔记-javascript-网络层封装
/** * @Author Mona * @Date 2016-12-08 * @description 网络层封装 */ /** * 封装基本请求方式 */ window.BaseRequest = ...
- 学习完成CSS布局(左右浮动)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...
- WPS宏不可用解决方法
在使用WPS Office过程中,遇见宏不可用,在启用宏的过程中提示获取VBA插件 解决方法: 1.下载VBA插件,下载地址:https://pan.baidu.com/s/1LqBmXw37U0km ...
- oracle 11g怎样配置才能连接远程数据库
打开所有程序->找到oracle-oradb11g-home1->Net Configuration Assistant,如图所示 选择本地网络服务名配置,点击下一步 选择添 ...
- 分布式系统 SOA与中间件
在分布式系统中,有一个基础的理论 CAP,Consistency一致性 Availability可用性 Partition Tolerance分区容忍性,任何一个系统都不可能同时满足这三个条件(高富帅 ...
- python-静态方法staticmethod、类方法classmethod、属性方法property
Python的方法主要有3个,即静态方法(staticmethod),类方法(classmethod)和实例方法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def ...
- AJAX跨域问题解决方法(4)——调用方解决跨域
调用方解决跨域的方法只有一种,那就是隐藏跨域. 何为隐藏跨域? 隐藏跨域的核心思路是通过反向代理隐藏跨域以欺骗浏览器 什么是反向代理?反向代理是指通过中间服务器使得访问同一个域名的两个不同url最终会 ...
- Python3.x:Selenium中的webdriver进行页面元素定位
Python3.x:Selenium中的webdriver进行页面元素定位 页面上的元素就像人一样,有各种属性,比如元素名字,元素id,元素属性(class属性,name属性)等等.webdriver ...
- 照着官网来安装openstack pike之keystone安装
openstack基础环境安装完成后,现在开启安装keystone服务(在控制节点上执行下面所有操作) 1.为keystone创建数据库 mysql -u root -p MariaDB [(none ...