JMeter Tutorial Simple Stress test

Source: Internet
Author: User
Tags jmeter tutorial

JMeter is a very useful tool for stress testing. JMeter is designed to be a lightweight stress test, and it takes only more than 10 minutes to write the scripts needed for stress testing.

Read Catalogue

    1. What is a stress test?
    2. A common tool for stress testing
    3. Steps to do stress testing
    4. This paper makes a case of stress test
    5. First step: parameterize using CSV Data Set config
    6. Step two: Add the HTTP Request
    7. Step three: Use the thread Group to control how many users are impersonating
    8. Fourth Step: Add summary Report to view test reports
    9. Fifth step: Run under
    10. Download source code

What is a stress test?

As the name implies: The pressure test, is the system under test, under certain access pressure, see whether the program is stable/stable server operation (Resource usage)

For example: 2000 users at the same time to a shopping site shopping, these users can open the page is slow, or whether the site will collapse

A common tool for stress testing

Do stress test, generally use tools, manual is no way to do. The most commonly used tool is LoadRunner, but LoadRunner is a fee-paying software, and is more complex to use. Now more and more people are starting to use JMeter to do stress tests. It's free and very simple to use.

The steps to do the stress test are as follows:

1. Writing scripts or recording scripts

2. Using user-defined parameters

3. Scene Design

4. Use the controller to control how many users are impersonating.

5. Use the Listener to view test results

This article is an example of stress testing

This article gives an example of using JMeter to simulate 200 users on a single computer, and to use Bing to search for different keywords to see if the time returned by the page is within the normal range.

First step: parameterize using CSV Data Set Config

First, we put the 2 parameters needed for the test in the TXT file,

Create a new Data.txt file, enter some data, a row with two data, separated by commas.

Start JMeter, add a thread Group first, and then add a CSV Data set config (Add, config Element, CSV data set config)

Step two: Add the HTTP Request.

We add HTTP requests, send get to http://cn.bing.com/search?q= Blog Park + Small Tank

Select the thread Group right (Add->sampler, HTTP Request) to fill in the following data:

Step three: Use the thread Group to control how many users are impersonating

Select the thread Group

Number of Threads (users): One user takes one thread, 200 threads is impersonating 200 users

Ramp-up Period (in seconds): Sets how long the thread will take to start all. If the number of threads is 200 and the preparation time is 10, then 1 seconds will be required to start 20 threads. That is, starting 20 threads per second.

Loop Count: The number of times each thread sent a request. If the number of threads is 200 and the number of cycles is 10, then each thread sends 10 requests. The total number of requests is 200*10=2000. If "Forever" is checked, all threads will continue to send the request until you choose to stop running the script.

Fourth Step: Add summary Report to view test results

Check the thread Group right (ADD-Listener, Summary report)

Fifth step: Run a bit

So far, the script is all written, let's run, how to look at the results of the test

Download source code

Click here "Small Tank" to download the source code, you should pay attention to modify the path of Data.txt

JMeter Tutorial Simple Stress test

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.