Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)(转载)...
轉載自: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?
?
?
?Start a single clients
Start all clients
?
?
Limitations
There are some basic limitations for distributed testing. Here's the list of the known items in no specific order.
簡單點的說
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
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)(转载)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 共享打印机,解决驱动检测失败无法连接共享
- 下一篇: 删除唯一性约束unique