jmeter-00 JMeter 运行过程
一.GUI mode 圖形化界面運(yùn)行
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) 非圖形化界面運(yùn)行?
For load testing, you must run JMeter in this mode
命令選項(xiàng)有:
D:\apache-jmeter-3.3\bin>jmeter -?_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____/ \ | _ \ / \ / ___| | | | ____| | | \/ | ____|_ _| ____| _ \/ _ \ | |_) / _ \| | | |_| | _| _ | | |\/| | _| | | | _| | |_) |/ ___ \| __/ ___ \ |___| _ | |___ | |_| | | | | |___ | | | |___| _ < /_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_\ 3.3 r1808647Copyright (c) 1999-2017 The Apache Software Foundation--?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. "-t LAST" will load lastused 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, --nonguirun JMeter in nongui mode-s, --serverrun 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=123or -Gglobal.properties-D, --systemproperty <argument>=<value>Define additional system properties-S, --systemPropertyFile <argument>additional system property file(s)-f, --forceDeleteResultFileforce 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, --runremoteStart 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, --remoteexitExit the remote servers at end of test (non-GUI)-g, --reportonly <argument>generate report dashboard only, from a test results file-e, --reportatendofloadtestsgenerate 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 8000?
GUI mode should only be used for creating the test script, NON GUI mode must be used for load testing
?
三、分布式運(yùn)行
(1)控制機(jī):也可以參與腳本的運(yùn)行,同時(shí)它也擔(dān)負(fù)著管理遠(yuǎn)程負(fù)載機(jī)指揮遠(yuǎn)程負(fù)載機(jī)運(yùn)行的任務(wù),并且收集遠(yuǎn)程負(fù)載機(jī)的測(cè)試結(jié)果。
(2)負(fù)載機(jī):向被測(cè)應(yīng)用服務(wù)器發(fā)起負(fù)載的機(jī)器。負(fù)載機(jī)首先要啟動(dòng)一個(gè)客戶端程序(Agent:jmeter-server.bat),這樣控制機(jī)才能接管負(fù)載機(jī)。控制機(jī)會(huì)把運(yùn)行的腳本隱蔽地發(fā)送到遠(yuǎn)程負(fù)載機(jī),但是如果運(yùn)行的測(cè)試腳本有參數(shù)文件及依賴(lài)的jar包時(shí),控制機(jī)并不能把它們發(fā)送到遠(yuǎn)程負(fù)載機(jī),這種情況就需要手動(dòng)拷貝了。
(3)遠(yuǎn)程運(yùn)行邏輯:
遠(yuǎn)程負(fù)載機(jī)首先啟動(dòng)Agent程序,待控制機(jī)連接;
控制機(jī)連接上遠(yuǎn)程負(fù)載機(jī);
控制機(jī)發(fā)送指令(腳本及啟動(dòng)命令)啟動(dòng)線程;
負(fù)載機(jī)運(yùn)行腳本,回傳狀態(tài)(包括測(cè)試結(jié)果)
控制機(jī)收集結(jié)果并顯示。
?
舉例:在10.1.102.68 機(jī)器中啟動(dòng)jmeter 作為控制機(jī),在10.1.102.75 機(jī)器中啟動(dòng)jmeter作為負(fù)載機(jī)。
方式一:控制機(jī)以GUI方式運(yùn)行
1.首先在68 jmeter 的jmeter.properties 中指定"remote_hosts" (修改了jmeter.properties 文件需要重新啟動(dòng)JMeter才可以生效)
# Remote Hosts - comma delimited remote_hosts=10.1.102.75 #remote_hosts=localhost:1099,localhost:20102.在75 中,啟動(dòng)JMeter Agent 程序,如
3. 在68中,啟動(dòng)jmeter,做一個(gè)簡(jiǎn)單配置,如下:
點(diǎn)擊遠(yuǎn)程全部啟動(dòng)即可。
?此時(shí)如果正常運(yùn)行,則75中的agent 控制臺(tái)中輸出如下:
?
?方式二:控制機(jī)通過(guò)非GUI方式運(yùn)行
1. 配置測(cè)試計(jì)劃
2.?在75 中,啟動(dòng)JMeter Agent 程序,如
3. 在68中, 命令行執(zhí)行如下:
D:\apache-jmeter-3.3\bin>jmeter -n -t F:\jmeter_workspace\測(cè)試計(jì)劃-遠(yuǎn)程運(yùn)行實(shí)例.jmx -l F:\jmeter_workspace\remote.jtl -R 10.1.102.75 Creating summariser <summary> Created the tree successfully using F:\jmeter_workspace\測(cè)試計(jì)劃-遠(yuǎn)程運(yùn)行實(shí)例.jmx Configuring remote engine: 10.1.102.75 Starting remote engines Starting the test @ Fri Nov 03 17:19:54 CST 2017 (1509700794827) Remote engines have been started Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445此時(shí)如果正常運(yùn)行,則75中的agent 控制臺(tái)中輸出如下:
?
?四、通過(guò)命令行覆蓋屬性配置
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實(shí)例:從命令行中,指定運(yùn)行線程數(shù)與url
命令行執(zhí)行命令:
jmeter -n -t "mock_api .jmx" -JthreadCount=5 -Durl=10.1.102.75?
五、命令行選項(xiàng)與properties配置的處理順序
?
***微信掃一掃,關(guān)注“python測(cè)試開(kāi)發(fā)圈”,了解更多測(cè)試教程!***轉(zhuǎn)載于:https://www.cnblogs.com/guanfuchang/p/7779371.html
總結(jié)
以上是生活随笔為你收集整理的jmeter-00 JMeter 运行过程的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: FONT Awesome 图标
- 下一篇: 命名函数表达式探秘