installation
:http://jmeter.apache.org/download_jmeter.cgi
Installation Prerequisites (because JMeter relies on Java, you must first configure Java).
Unzip after download:
Tar-xvzf apache-jmeter-3.1.tgz
jmeter Parameters
[HTML]View PlainCopy
- -H,--help
- Print usage information and exit
- #打印帮助信息
- -V,--version
- Print the version information and exit
- #打印版本信息
- -P,--propfile {argument}
- The JMeter property file to use
- #运行时指定property文件, the default is to use the jmeter.properties in the Jmeter_home/bin directory, if the user has other configurations, add
- #用法如下:-P user.properties
- -Q,--addprop {argument}
- Additional property file (s)
- #其它配置文件, such as JVM parameters, etc.
- -T,--testfile {argument}
- The JMeter test (. jmx) file to run
- #要运行的jmeter脚本
- -j,--jmeterlogfile {argument}
- The JMeter log file
- #指定记录jmeter log file, default to Jmeter.log
- -L,--logfile {argument}
- The file to log samples to
- #记录采样器Log的文件
- -N,--nongui
- Run JMeter in Nongui mode
- #以nongui模式运行jmeter
- -S,--server
- Run the JMeter server
- #运行JMeter Server
- -H,--proxyhost {argument}
- Set a proxy server for JMeter
- #代理服务器地址
- -P,--proxyport {argument}
- Set Proxy Server port for JMeter
- #代理服务器端口
- -U,--username {argument}
- Set username for proxy Server JMeter
- #代理服务器的用户名
- -A,--password {argument}
- Set password for proxy server JMeter
- #代理服务器用户名对应的密码
- -j,--jmeterproperty {argument}={value}
- Define Additional JMeter Properties
- #定义额外的Jmeter属性
- -G,--globalproperty (argument) [= (value)]
- Define Global Properties (sent to servers)
- e.g. -gport=123
- Or-gglobal.properties
- #定义发送给server的全局属性
- #如:-gport=123 or-gglobal.properties (specifies the port of the listener server)
- -D,--systemproperty {argument}={value}
- Define Additional System Properties
- #定义系统属性
- -S,--systempropertyfile {filename}
- A property file to be added as System properties
- #通过指定的property文件定义系统属性
- -L,--loglevel {argument}={value}
- Define loglevel: [category=]level
- e.g. jorphan=INFO or jmeter.util=DEBUG
- #定义日志等级
- -R,--runremote (Non-gui only)
- Start remote servers (as defined by the JMeter property remote_hosts)
- #启动远程server (remote_hosts defined in JMeter property), this parameter is not valid in Non-gui mode
- -R,--remotestart Server1,... (Non-gui only)
- Start these remote servers (Overrides remote_hosts)
- #启动远程server (If you use this parameter, the remote_hosts defined in the JMeter property will be ignored)
- -D,--homedir {argument}
- The JMeter home directory to use
- #Jmeter运行的主目录
- -X,--remoteexit
- Exit the remote servers at end of test (Non-gui)
- #测试结束时, exit (in Non-gui mode)
Configuring JMeter Client & Server
After understanding the above parameters, start configuring the distributed test
Let's take a look at what the official documents say, and add comments to me in Chinese:
1. The firewalls on the systems is turned off. #1. Turn off the firewall
2. All the clients is on the same subnet. #2. All clients are within the same subnet
3. The server is in the same subnet, if 192.x.x.x or 10.x.x.x IP addresses is used. If the server
Doesn ' t use 192 or IP address, there shouldn ' is any problems. #3. Server must also be in the same subnet if 192.x.x.x or 10.x.x.x such IP addresses are used, if serv Er does not use an IP address of 192 or 10, (server is not in the same subnet as client) there will be no problem
4. Make sure JMeter can access the server. #4. Ensure that JMeter has access to the server
5. Make sure to the same version of JMeter on all the systems. Mixing versions
correctly. #5. Ensure that the JMeter versions of the systems are consistent and that different versions of JMeter will not work well
explanation of some terms:
· Master, run in GUI mode while controlling the run of the test, here is the client, the machine where the script is started.
· Slave, running Jmeter-server and receiving instructions from master, sending requests to the target server
Set Jmeter-server:
Open the Jmeter.properties file in the Jmeter_home/bin directory with a text editor and add the host IP that runs jmeter-server to Remote-hosts
remote_hosts=10.0.0.158, 10.0.0.140,localhost
If you do not want your client to run as Jmeter-server, remove localhost from the configuration above.
Note here: It is recommended to use the actual IP instead of localhost, otherwise it is easy to error.
Actual Combat stage:
First, the client starts JMeter in GUI mode and then opens or creates a test script
Second, start all remote server from GUI mode, method: Run-remote all start, see, can also start a single jmeter-server
Third, the use of No-gui method for pressure testing
Jmeter-t "JMS point-to-point.jmx"-n-l testresult.csv-r
-T: from which JMX boot
-N: Stress test in a no-gui manner
-L: Log log
-r: Start remote server (remote_hosts defined in JMeter property), this parameter is not valid in Non-gui mode
So far, the JMeter distributed test has been run through Non-gui mode.
Here's a tip: running JMeter in a distributed way is to run the same test script on all servers, that is, if you're going to 1s up to 100 threads, if you're using 5 machines for distributed testing, debug the script to 20 threads from 1s, otherwise, the 1s has 500 threads, which may differ from your expectations.
"Turn" JMeter distributed stress test