One-stop solution for automated performance testing based on JMeter and Jenkins (RPM)

Source: Internet
Author: User
Tags ssh port

Www.MyException.Cn netizens share in: 2015-08-26 views: 0 times

One-stop solution for automated performance testing based on JMeter and Jenkins

Author: Yu, Qingguo Shen, Vivien Wu,biyun

Background

Performance testing is used to ensure the performance of the system after the release of the product to meet user needs, in the software quality assurance plays an important role. JMeter is a widely used performance testing tool, however, users often have to spend a lot of extra effort and time configuring the test environment before performing the test. While testing, using a single server to simulate thousands of users to the target server load, limited by the performance of the server may not meet the demand, which requires a multi-server distributed concurrent test environment. So we decided to develop a one-stop solution for JMeter and Jenkins-based automated performance testing, the ELP (easy load and performance testing, simple load performance test) to address these issues.

JMeter is a pure Java development and open-source performance testing tool, which can be started in a GUI mode or Nongui mode, the ELP uses Nongui mode to start JMeter and perform distributed testing, the Start command is: Jmeter-n-t Testplan.jmx–r Slave1,slave2. For more information on JMeter, see appendix [3].

Continuous integration (ci,continuous integration) as the cornerstone of agile programming is now widely adopted by most development teams, and automated continuous integration testing is becoming increasingly popular. The Continuous Integration tool we currently use is Jenkins, and our solution integrates seamlessly with the Jenkins server. For more information about Jenkins, see appendix [1] and [2].

Overview

We developed a Jenkins plugin to complete the entire performance testing process, where JMeter master was started on the CI server and was responsible for assigning and dispatching JMeter Slave (starting on traffic server) to perform the test task. For a plugin on how to develop Jenkins, see appendix [5]. See appendix [4] for distributed testing using JMeter. The design requirements of the ELP are as follows:

1) Simple user interface.

2) automatically complete the configuration of the test environment.

3) Support for common performance testing requirements.

4) Call JMeter for distributed testing.

5) Collect the performance metrics of the target server.

6) Generate chart reports based on performance metrics data.

In addition to the above functional requirements, we use the available resources as much as possible, and we use the existing Jenkins plugin performance plugin to present the test results. Currently, this program supports all common performance tests, such as Web application testing, database testing, and so on.

Is the user interface of the ELP, the user only needs to fill in the relevant configuration information. Because of the need to resolve firewall issues, users are required to enter a user name and password to log on to the remote server to establish an SSH tunnel where the password is encrypted and stored to disk.

Figure 1

is a graphical report that the ELP collects the performance metrics of the target server after the test is performed.



Figure 2

is a picture of the test results report that is displayed using Performance plugin after performing the test. You can show the results of each test, or you can show a trend chart of historical test results.


Figure3

The ELP basic work flow

1. Install serveragent on the target server to collect performance metrics.

2. Install the jmeter on each jmeter slave and start the JMeter Server.

3. Establish an SSH tunnel with each jmeter slave.

4. Start the distributed test.

5. Collect the performance indicators and export them.

6. Show the test results.

Figure 4

Architecture and implementation Details

The ELP is integrated into the continuous integration server in the form of a Jenkins plug-in. The overall structure of the ELP is shown in the diagram.

Figure 5

The ELP is developed using the MVC model, M (model) refers to the class that holds the ELP-related data, and V (view view) refers to the user interface of the ELP, and C (Controller controllers) refers to the Elpbuilder class that receives user input data and controls the output of the model.

1. View

The user interface of the ELP allows the user to enter the host name of the target server, add the hostname of each trafficserver to be used, the login account and password, the file name of the test plan, the name of the test data, and so on. The user interface is implemented by designing jelly pages, which can be found in the reference documentation [6].

2. Model

The model is primarily used to hold data about the ELP and business logic that controls access to and modification of the data. Where passwords are encrypted and then stored, decrypted and reused when the password is removed.

3. Controller

The controller is associated with views and models to receive user input on the user interface and to control the model's data display to the user interface. The Elpbuilder class in the ELP inherits the Hudson.Task.Builder class. The main entry point of the ELP is the perform method in the Elpbuilder class, which implements the automatic configuration of the test environment in the Perform method, establishes the SSH tunnel, performs the distributed test, displays the performance index and other functions. The plugin of Jenkins execution shell is reused in the ELP code, so the following steps are implemented through shell script, which is very concise. The use of shell script significantly reduces development effort compared to the Java-using SSH solution.

1. Install ServerAgent on target server and start.

2. Install JMeter on each traffic server and start JMeter server.

Command:jmeter-server-djava.rmi.server.hostname=127.0.0.1-jserver.rmi.localhostname=127.0.0.1- jserver.rmi.localport=55601-jserver_port=55501 (the meaning of the corresponding property set in the command is described in the note in file jmeter.properties.) )

3. Establish an SSH tunnel between master and each slave.

Command:sshpass-p ' password ' ssh-l 55501:127.0.0.1:55501-l 55601:127.0.0.1:55601-r55500:127.0.0.1:55500 [email Protected]

4. Perform distributed testing.

Command:jmeter-djava.rmi.server.hostname=127.0.0.1-jclient.rmi.localport=55500-n-T testplan.jmx–r slave1, Slave2 (127.0.0.1:55501)

5. Release performance metrics.

Generate performance graphical metrics reports using JavaScript Chart library highcharts. For the use of Highcharts, see appendix [7].

4. Introduction to SSH tunneling

In the ELP, an SSH tunnel is required to bypass the firewall between the CI server and the traffic server, which focuses on the process of establishing an SSH tunnel between the CI server and the traffic server.

(1) connection between Jmeter Client and Jmeter server

When JMeter performs distributed testing, the Jmeterclient side (CI server) communicates with the JMeter server side (traffic server) through the JMeter connection and the remote method call (RMI). The JMeter connection is established by the JMeter client side, and RMI is established in two directions, that is, in addition to establishing a connection from the JMeter client side to the JMeter server side, a reverse connection is required to return the test sample results. Therefore altogether there is a need to establish three connections, as shown in.

Figure 6

(2) Establish an SSH tunnel between CI Server and traffic server

SSH tunnel is also known as SSH port forwarding, port forwarding is divided into Localforward and Remoteforward, where local refers to the native side, that is, the CI server side, remote point of the terminal, that is, the trafficserver side.

Localforward refers to forwarding a port on the local server to the specified port on the remote specified server. As shown, forward the "A" port on the JMeter client side to the "B" Port of the server 127.0.0.1 (server native) specified on the JMeter server side.

Execute command on client side:ssh-la:127.0.0.1:b [email protected]


Figure 7

Remoteforward refers to the forwarding of a port on a remote server to the specified port on the specified server on the local side. As shown, forward the "B" port on the JMeter server side to the "A" Port of the server 127.0.0.1 (client native) specified on the JMeter client side.

Execute command on client side:ssh-r b:127.0.0.1:a [email protected]

Figure 8

As mentioned earlier, when performing a distributed test, the CI server needs to establish three connections between the JMeter and each trafficserver. As shown in: Port 55501 for JMeter connection, 55601 port for RMI connection to traffic server for CI server, and 55500 port for RMI connection traffic server to CI server.

The command for the CI server to establish an SSH tunnel with a traffic server is:ssh-l 55501:127.0.0.1:55501-l 55601:127.0.0.1:55601-r 55500:127.0.0.1:55500 [ Email protected]

Figure 9

(3) Establish SSH tunnel between CI server and multiple Trafficserver

There is very little information available on the Internet for SSH tunneling when using multiple jmeter slave. Our solution in the ELP is that if multiple commands are executed with multiple trafficserver, the connection between the CI server and each traffic server is differentiated by different ports. The implementation method is: each additional traffic Server,ci server side needs to specify two additional idle ports for the JMeter connection and client-side to server-side RMI connection, traffic The server side needs to specify a port for the server-side RMI connection to the client side.

When adding another traffic server, specify a different port (assuming that the port specified on the CI server side is 55502 and the port specified by the 55602,traffic server side is 55500), and then execute the same command:ssh-l 55502:127.0.0.1:55502-l 55602:127.0.0.1:55602-r 55500:127.0.0.1:55500 [email protected]


Summary

Subsequent plans use the Mesos Cluster Manager to dispatch and distribute JMeter Slave, which optimizes the performance of the ELP and greatly improves resource utilization. At the same time, plan to design a solution to replace the components in the company that are currently used in the project and try to open up the project.


Resources

1. The official web site for jenkins:http://jenkins-ci.org/

2. The description about Jenkins on Wikipedia:http://en.wikipedia.org/wiki/jenkins_%28software%29

3. https://jmeter.apache.org/

4. Https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf

5. Http://ccoetech.ebay.com/tutorial-dev-jenkins-plugin-distributed-jenkins

6. Https://wiki.jenkins-ci.org/display/JENKINS/Basic+guide+to+Jelly+usage+in+Jenkins

7. http://www.highcharts.com

One-stop solution for automated performance testing based on JMeter and Jenkins (RPM)

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.