Fourth article: Adding a thread Group

Source: Internet
Author: User
Tags http file upload http post md5 hash keep alive

1. Test requirements: Build 20 users, access www.baidu.com, and see an average response time at 30QPS load;

Qps:query per second A second query rate, is the query server can process the number of queries per second, on the Internet, as a domain Name System server performance is commonly measured per second query rate;

2. Test steps:

Number of threads: number of virtual users, a virtual user consumes a process and thread, and sets the number of virtual users here, which is how many threads are set;

Preparation time: Unit S: Set how much time virtual users need to start all, for example: set 20, the preparation time is 10, then 10 seconds to start 20 threads, that is 2 per second;

Number of cycles: the number of times each thread sends a request, if the number of threads is 20, and loop count is 5, then each thread sends 5 requests, the total request is 20*5, and if "Forever" is checked, all threads will continue to send the request until the selection stops running the script;

Configuration of the 3.HTTP request:

Name: Used to identify a sampler, it is recommended to use a meaningful name;

Note: For testing is not useful, only for notes;

Server ip:http the destination server or IP address that the request is sent;

Port number: The port number of the destination server, by default: 80

Timeouts: Sets the time-out for request and response time;

Protocol: HTTP or HTTPS

Method: Send HTTP Method: Get post, head put options trace Delete, etc.

Content encoding: The encoding of the contents, by default: ISO8859

brutishness: Destination URL, note does not include the address and port of the server

Automatic redirection: If the item is selected, JMeter automatically redirects to the new page when the HTTP request is 302/301;

Use keep Alive:jmeter and target server for HTTP communication using Keep-alive mode (also known as persistent link, link reuse), which is selected by default

Use Multipart/from-data for HTTP POST: When sending an HTTP request, it is sent by using the Multipart/from-data method, which is not selected by default;

Send parameters together with the pass request:

The parameters can be sent at the time of sending the request;

Send files together: In a request to send a file, usually the HTTP file upload behavior can be simulated in this way

Get resources from HTML: default unchecked, if checked, jmeter after the request, the response, the HTML file will be analyzed and get the HTML content, including pictures, Flash and so on;

Used as a monitor: This sampler is treated as a monitor, and the graphical statistics of the sampler can be seen in the monitoring results, which are not selected by default;

Save response as MD5 hash: Select to record the value of the MD5 returned by the server at execution time, without logging the full response data, it is recommended to select the item when a very large amount of data is required to reduce the cost of the sampler recording the response data;

Tips: The default time unit is milliseconds and the output file suffix is reported. Jtl

3. Set the QPS limit:

JMeter provides a very useful timer: Constant throught timer (constant throughput timer), which can conveniently control the throughput of a given sampler to send requests;

Constant throughtput Timer: The main attributes:

Target Throughtput (in samples per minute): Destination throughput, here is the number of requests sent per minute, the actual number is: 60*qps second, Calculate throughput based on: There are 5 options, respectively:

This thread is only: controls the throughput of each thread, when this mode is selected, the total throughput is the set target throught multiplied by the number of threads;

All active Threads: Set the target throughput will be allocated on each active thread, each active thread after the last run, wait for a reasonable time to run again after the active thread, refers to the same moment, while running the thread;

All active threads (shared): The option for all active threads is basically the same, except that each active thread waits for a reasonable time after the end of all active threads to run again;

All Active Threads Threads Group: Set the target throughput to assign the task on every active thread that the current thread rents, and when there is only one thread group in the test plan, this option and all active Threads the same effect,

All active threads in the current threads Group (shared) and all active threads in the current threads group are basically the same, except that each active thread will be on all active lines After the last run of the process to wait, after a reasonable time to run again;

Fourth step: Add listeners:

After the main part of the script is set up, the test results in the performance test need to be obtained in some way, in this case we only care about the request response time;

Jmeter uses listener components to collect data from sampler records and visualize them, Jmeter has a variety of different types of listening, because HTTP requests allow us to add aggregated reports to view test results more intuitively.

Add Aggregation Report: Right-click on the thread group and select Aggregate Report in the popup menu (add---Listen---aggregation report).

Add View results tree (Add---Listen---view result tree)

5. Run the script

6. Aggregation Report Analysis

Samples: Indicates how many requests have been made in this test, if the simulation of 10 users, each user iteration, 10 times, then this shows 100

Average: Average response time,---By default is unit, request, average response time, and when transaction Controller is used, the average response time can also be displayed transaction for the unit.

Median: The median, which is the response time of 50% users;

90%line:90% Response time for users

Min: Minimum response time;

Max: Maximum response time;

error%: The total number of errors/requests that occurred in this test.

Throughput: Throughput,---By default represents the number of requests completed per second (request per second), when used, transaction controller, can also represent a similar (LoadRunner) Transaction per second number;

Response Time unit: milliseconds, see script:

7.Jmeter Assertion (checkpoint):

Assertions add a layer of judging mechanism to the return level of the request. Because the request succeeds, does not mean the result must be correct, therefore needs the detection mechanism to improve the test accuracy, the following describes commonly used jmeter three kinds of assertions;

1. Response Assertion:

2.Size assertion (Size assertion)

3.Duration assertion (Duration assertion)

If the response time is greater than the set response time, the assertion fails, otherwise fails, otherwise succeeds!

8.Jmeter parameterization:

1. User parameters: Here's a look at CSV data setconfig

3. Stochastic parameterization:

9.JMETER meeting point:

Procedure----step--Timer---Synchronizing timer

Note: The assembly point needs to be placed in front of the assembly's components;

10.jmeter Association:

1. The Regular expression extractor:

Add---post processor---regular expression extractor:

Regular Expression Section configuration description:

1. Reference name: The next request to reference the name of the parameter, such as fill ActivityID, you can use ${activityid} reference it;

2): Regular expression:

() the part that is to be extracted

. Match any string

+: one or more times

? : Stop after the first match is found

3) MO version: With $$ reference, if there are more than one regular expression in the regular expressions (more than the parentheses around the east), it can be $2$3$3 and so on, representing the value of the resolution to the title, such as: $1$2 expression of the 1th value of the analytic ethics;

4) matching numbers: 0 for random values, 1 for all values

5) Default value: If the parameter is not worth the value, it defaults to a value that allows him to take

Fourth article: Adding a thread Group

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.