JMeter Performance Test Basics (1)-Installation and simple use

Source: Internet
Author: User

Apache JMeter is an open-source performance testing tool that is written in Java and can be used for performance testing. JMeter was originally designed for web application testing and was later extended to multiple test areas.

Apache JMeter can be used for static resources and dynamic resources (including webservices (soap/rest), Dynamic Web languages (PHP, Java, ASP, files, and other content), Java objects, database and data queries, FTP server, etc.) for performance testing. It can be used to simulate heavy loads on servers, clusters, networks or objects to test their strength or to analyze the overall performance under different pressure types. You can use it to do graphical analysis of performance or to test your server/scripts/objects in a large concurrent load.

This article mainly introduces the installation of JMeter and the basic use method.

1. Installation

JMeter's official website is http://jmeter.apache.org/

To http://jmeter.apache.org/download_jmeter.cgi

JMeter currently has the latest version of 2.13, and the corresponding Java version needs to be at least Java6. After the download is complete, unzip directly, in the bin directory of JMeter, locate the Jmeter.bat file, double-click Run

Main interface

2. Basic knowledge

After the program runs, we can see that the JMeter is organized and tested in the form of a test plan. Right-click on the test plan and select "Add", we can see that the JMeter mainly contains the following components:

Thread Group (Threads)-represents a certain number of concurrent users that can be used to impersonate a concurrent user to send a request. The actual request content is defined in sampler, and all requests need to be included in the thread group.

Test Fragment-The test fragment is a special type of controller that is sibling to the thread group in the test plan. The difference between a test fragment and a thread group is that in a test plan, the thread group itself is executed, and the test fragment itself is not executed. The test fragment is executed only if it is referenced by a module controller or is included in a controller. Simply put, we can understand the thread group as an entry function and interpret the test fragment as a private function, and the test fragment will be executed only when it is called.

Configure components – Configure the component to maintain the configuration information required by the sampler and modify the requested content according to the actual needs.

Timer-Defines the delay interval between requests.

Pre-processor, post-processor-responsible for completing the work before and after generating the request. The predecessor processor is often used to modify the requested settings, and the post processor is often used to process the response data.

Assertion-Used to determine whether the result of a request response is as expected by the user. It can be used to check the validity of the test, isolate the problem domain, and perform the stress test if the function is correct.

Listener-Collects test results and displays them in a variety of ways.

Let's add a thread group and right-click to see the other two components under the thread group:

Logical controller-You can customize the behavior logic of the JMeter send request, which is used in conjunction with sampler to simulate complex request sequences.

Sampler (Sampler)-used to send various requests and perform performance tests on the basis of that request.

3. Simple example

Let's take a simple performance test using JMeter as an example of concurrent access for a single URL.

1) Set up thread groups

After setting up the test plan, we first set up a thread group and set up the following.

which

Number of threads-Indicates how many threads JMeter will initiate for target access

Ramp-up period– indicates how long (in seconds) the JMeter will start to complete these threads

Cycle Count – Indicates how many times JMeter will iterate over the current thread group

2) Set up sampler (Sampler)

To add a sampler for an HTTP request to a thread group

The configuration is as follows (JMeter's large number of concurrent accesses are blocked by certain sites as malicious attacks, it is recommended to choose your own website or operate on localhost )

3) Add listener

Here we add a "graphical result" and a "view results with a table".

4) Run the test to see the results

Run the test and look at the graphical results, we can see the amount of data accessed, the average access time, median value, the amount of deviation from access (the difference between access time and median time), throughput.

Looking at the results of the table, we can see the threads we initiated, the start time, the sampling time, the status (whether the access was successful), the amount of data that was transferred, the access delay, and the access time.

5) Results Analysis

The results obtained from the listener can be exported, and we will then perform further data analysis of these results to estimate the performance of our website.

In the next article, we will describe how to configure the URL to be accessed using variables.

JMeter Performance Test Basics (1)-Installation and simple use

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.