Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)(转载)...
轉(zhuǎn)載自: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.
簡(jiǎn)單點(diǎn)的說
Jmeter分布式執(zhí)行原理:
1、Jmeter分布式測(cè)試時(shí),選擇其中一臺(tái)作為調(diào)度機(jī)(master),其它機(jī)器做為執(zhí)行機(jī)(slave)。
2、執(zhí)行時(shí),master會(huì)把腳本發(fā)送到每臺(tái)slave上,slave 拿到腳本后就開始執(zhí)行,slave執(zhí)行時(shí)不需要啟動(dòng)GUI,我理解它應(yīng)該是通過命令行模式執(zhí)行的。
3、執(zhí)行完成后,slave會(huì)把結(jié)果回傳給master,master會(huì)收集所有slave的信息并匯總。
術(shù)語(yǔ)解析
- master,以GUI模式運(yùn)行,同時(shí)控制測(cè)試的運(yùn)行,在這里就是client,啟動(dòng)腳本所在的那臺(tái)機(jī)器。
- slave,運(yùn)行jmeter-server并從master接收指令、向目標(biāo)服務(wù)器發(fā)送請(qǐng)求
-
設(shè)置jmeter-server:
用文本編輯器打開Jmeter/bin目錄下的jmeter.properties文件,添加運(yùn)行jmeter-server的主機(jī)IP到remote_hosts
remote_hosts=192.168.30.50:1099,192.168.30.51:1099,localhost.....
?如果你不希望你的客戶端也作為jmeter-server運(yùn)行的話,把localhost從上面的配置中移除。
?
小白解釋分割線
?----------------------------------------------------------
再白癡點(diǎn)的解釋就是 ? 有 A B C ?三臺(tái)壓力機(jī)器,屬于同一個(gè)內(nèi)網(wǎng)IP
A作為 Master
B跟C兩臺(tái)作為slave
通過A去控制B跟C進(jìn)行壓測(cè)服務(wù)器
在壓測(cè)的過程中 需要先開啟B跟C的Jmeter的bin目錄下的jmeter-server.bat 服務(wù)
然后通過A去進(jìn)行NON-GUI模式去壓測(cè),B跟C分布式的壓測(cè)結(jié)果會(huì)反饋到A
-----------------------------------------------------------
小白解釋結(jié)束線
?
下面進(jìn)行實(shí)戰(zhàn)命令 壓測(cè)
通過 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)------------------啟動(dòng)遠(yuǎn)程服務(wù)器(如remote_hosts中定義)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)-------------------啟動(dòng)這些遠(yuǎn)程服務(wù)器(覆蓋remote_hosts)
那么我們就可以去選擇執(zhí)行所有的配置中的壓測(cè)機(jī)器
D:\Jmeter\jmeter-3.1\bin\jmeter.bat -n -r -t test.jmx -l test.csv -e -o?test
?
可以看到已經(jīng)成功執(zhí)行了配置中的2臺(tái)壓測(cè)機(jī)
?
PS 如果壓測(cè)指標(biāo)是1000并發(fā)數(shù),比如我們現(xiàn)在配置了2臺(tái)需要達(dá)到1000并發(fā)數(shù),那么就是一臺(tái)壓測(cè)并發(fā)數(shù)500即可
?
轉(zhuǎn)載于:https://www.cnblogs.com/yuany66/p/10978139.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的Jmeter之http性能测试实战 NON-GUI模式 进行分布式压力测试——干货(十二)(转载)...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 共享打印机,解决驱动检测失败无法连接共享
- 下一篇: 删除唯一性约束unique