Linux uses JMeter for distributed stress testing

Source: Internet
Author: User

1. Download JMeter tgz file http://jmeter.apache.org/download_jmeter.cgi

2. Log in to the Linux server, create jmeter directory, RZ upload JMeter

3. Tar xvf + jmeter tgz file name

4. Add jmeter environment variable Vi/etc/profile

Added: jmeter=/data/soft/jmeter/apache-jmeter-3.0//Own installation path
Classpath= $CLASSPATH: $JMETER/lib/ext/apachejmeter_core.jar: $JMETER/lib/jorphan.jar: $JMETER/lib/logkit-2.0.jar
Path= $PATH: $JMETER/bin

5. Source/etc/profile

6. Jmeter-v to see if the setting is successful

7. Create Testplan TestResult subdirectories in the JMeter directory

8. RZ upload jmx script to Testplan

Script uses BeanShell: (Can return output to Jmeter.log)

Prev.setdataencoding ("UTF-8");
String response_data = prev.getresponsedataasstring ();
Log.error ("Response_data----------------:" +response_data);

9. If a host enters/etc/hosts to join its own host configuration (this process can be written as a shell script, each time just execute the script)

The Hosts file functions as DNS, providing IP addresses to hostname, and Linux systems will query the/etc/hosts file before issuing a domain name resolution request to the DNS server, and if there is a corresponding record, the records inside the hosts will be used.

View the current host hostname (actually, regardless of the host used to execute the script, the command returns the host is the same as the system started, to modify, need to modify the server will not be permanently effective after the restart)

Vim/etc/sysconfig/network System Network configuration file-requires a reboot to be active and permanently modified. Hostname is a kernel parameter under the Linux system, which is stored under/proc/sys/kernel/hostname, but its value is read from Rc.sysinit when Linux starts. The value of hostname in/etc/rc.d/rc.sysinit is derived from hostname under/etc/sysconfig/network

/etc/init.d/network Restart Network configuration file after you restart the network

Jmeter-n-T Testplan/comic.jmx-l testresult/ RESULT1.JTL execute scripts and generate aggregated reports (can be seen in the JMeter directory Jmeter.log or in the Testplan directory, self-seeking, through the log to see where the error occurred)

-N means running the test plan in Nogui mode

-T represents the test plan, followed by the test plan name

-L indicates the test result followed by the test result file name

SZ Export aggregation report, open in Windows to view results

Distributed configuration:

1, with the above steps, configure the JMeter and environment variables on the new server

2, modify the bin/jmeter.properties on the control machine, add the slave IP and port (use-R to start all slave) 1099 is the default RMI communication port

# Remote Hosts-comma Delimited

remote_hosts=192.168.5.95:1099,192.168.5.103:1099

3. Open the Server service on the execution script machine, bin/jmeter-server

4. Executing distributed commands in the control machine

Jmeter-n-T testplan/comic.jmx-r 10.15.243.53,10.15.230.78-l testresult/result1.jtl specify slave IP

Jmeter-n-T Testplan/comic.jmx-r-l TESTRESULT/RESULT1.JTL start all slave execution scripts

Note: If there is a host also need to modify the slave host file, otherwise error will occur

Linux uses JMeter for distributed stress testing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.