当前位置:网站首页>JMeter stress testing tutorial

JMeter stress testing tutorial

2022-06-23 16:37:00 User 7353950

Jmeter It's a very useful stress testing tool .Jmeter For lightweight stress testing , Very suitable , It only takes ten minutes , You can write the scripts that you need for stress testing .

Read the directory

  1. What is stress testing
  2. Common tools for stress testing
  3. The steps to do the stress test are as follows :
  4. An example of stress testing in this paper
  5. First step : Use CSV Data Set Config To parameterize
  6. The second step : add to HTTP Request.
  7. The third step : Use Thread Group, Control how many users are simulated
  8. Step four : add to Summary Report Used to view test results
  9. Step five : Run it

What is stress testing

seeing the name of a thing one thinks of its function : Pressure test , Namely The system being tested , Under certain visiting pressure , See if the program runs stably / Is the server running stably ( Resource usage )

such as :2000 Users go to a shopping website at the same time , Will these users be slow to open pages , Or whether the website will crash

Common tools for stress testing

Do a stress test , Generally use tools , There is no way to do it manually . The most commonly used tool is LoadRunner, however LoadRunner After all, it's paid software , And the use is also more complex . Now more and more people begin to use it Jmeter To do a stress test . free , And it's very simple to use .

The steps to do the stress test are as follows :

1. Write the script Or record a script

2. Use user-defined parameters

3. Scene design

4. Using the controller , To control How many users are simulated .

5. Using a monitor , Check the test results

An example of stress testing in this paper

The example given in this paper is : Use... On a computer Jmeter simulation 200 Users , Use at the same time bing Search for different keywords , Check whether the return time of the page is within the normal range .

First step : Use CSV Data Set Config To parameterize

First, let's put what we need to test 2 Put two parameters in txt In file ,

Create a new one data.txt file , Enter some data , There are two data in a row , Separate with commas .

start-up Jmeter, First add a Thread Group, And then add a CSV Data Set Config (Add -> Config Element -> CSV Data Set Config)

The second step : add to HTTP Request.

We add http request , send out get

choice Thread Group Right click (Add ->Sampler -> HTTP Request), The data to be filled in are as follows :

The third step : Use Thread Group, Control how many users are simulated

Choose Thread Group

Number of Threads(users): A user occupies a thread , 200 A thread is a simulation 200 Users

Ramp-Up Period(in seconds): Set how long it will take for the thread to start completely . If the number of threads is 200 , The preparation time is 10 , You need to 1 Seconds start 20 Threads . It starts every second 20 Threads .

Loop Count: The number of times each thread sends a request . If the number of threads is 200 , The number of cycles is 10 , So each thread sends 10 Requests . The total number of requests is 200*10=2000 . If I check that “ forever ”, Then all the threads will keep sending requests , Until you choose to stop the script .

Step four : add to Summary Report Used to view test results

Choose Thread Group Right click (Add -> Listener -> Summary Report)

Step five : Run it

up to now , The script is all written , Let's run , How to see the test results

原网站

版权声明
本文为[User 7353950]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231553183364.html