Jmeter HTTP interface performance test

Source: Internet
Author: User
Jmeter HTTP interface performance test 1. Start jmeter

Jmeter download unzip can be used, jmeter start, click D: \ ProgramFiles \ jmeter \ apache-jmeter-2.8 \ bin under the jmeter. bat can be.

2. Add a thread group

For example, add a thread group.

The thread group is equivalent to the vuser of LoadRunner. The content of the thread group is configured here. The following configurations are required:

1) Number of threads: set the number of threads sending requests.

2) ramp-up period: Specifies the total length of time for starting thread data. For example, if s and 10 threads are set, a thread is started every 10 seconds.

3) number of cycles: the number of repeated requests. If "forever" (default) is selected, the request will continue. If "forever" is not selected ", if you enter a number in the input box, the request repeats the specified number of times. If you enter 0, the request is executed once.

4) scheduler: This scheduler is used to set the running time. Both the start time and end time must be set. If the current time does not reach the start time, it will wait. If the current time reaches the end time, the thread will be stopped.

3. Add an HTTP request

Show how to add HTTP requests

An HTTP request is added with the above interface, which is used to set the HTTP request. You must set the following points:

1) Web server: enter the name of the requested server, the port number of the interface, and the connection and response time threshold. If the connection times out or the response time times out, the request is regarded as failed; the path is the request path following the server name ;.

2) HTTP Request: Set the implementation method. You can select the sending method. The protocol is the Protocol we use, and whether the get or POST method is used for sending. You can also set the encoding, such as GBK; the request URL path does not include the IP address or the part after the server name.

3) parameters sent together with the request: You can set the parameters here. You can enter the value yourself or use the custom variable \ $

{Paraname}

To select one of many instances.

4. Add Parameters

In the above request, we can see that the \ $

{Para_url}

This is the user-defined parameter. There are several ways to implement parameters. Because the data volume is large during performance testing, you can set parameters using CSV Data Set config.

The above is the CSV data config setting interface, which is explained as follows:

Filename: the address of the data file. It can be an absolute or relative address. If you enter the name as shown in the figure, you need to put the data file in the same directory as the test plan.

1) file encoding: the encoding of the Read File

2) variable names: name of a parameter. Multiple parameters are separated by commas (,), for example, name and password.

3) delimiter: the delimiter used to separate records in a file. For example, we use tab as \ t.

4) Allow quoted data: Generally, false is enough. However, you can set true if there are some special values.

5) Recycle on EOF: If the value is true, the cyclic value is allowed. That is to say, if all data in the text is obtained once, the value is taken from the first row of the file again. If it is false, the following Stop thread on EOF will be used to execute the action.

You can set multiple parameters for the HTTP request. This parameter setting method is widely used, and can be used in both HTTP and Java samples.

5. Add listeners

Listeners are generally used to give results. You can add a listener to view the request response time and response data. Sometimes the listener seriously affects the performance of the jmeter client. If you want to provide performance results, it is best not to add too many listeners for Io operations. However, these listeners, such as the result tree, can be used during debugging and interface testing.

From the above we can see that there are a lot of listeners, select the necessary listener in the performance test. You can delete unused listeners first.

Generally, listeners such as the number of results to be viewed and the result to be viewed in tables are used during debugging. The detailed request and returned content are displayed here.

The aggregate report contains an aggregate report for the entire scenario, which provides response time, QPS, and other values. You can add listeners as needed.

6. Start the test plan

Start in running, and the green arrow in the graphical tool below can start the test plan.

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.