Locust Performance Module Talking

I came into contact with the Locust performance module today, let’s introduce the installation and simple applications

1. Installation method: pip install Locust

Locust supports Python 2.7, 3.4, 3.5, and 3.6. The editor’s environment is python3.6. Just install it directly with pip

2. After installation, enter: locust –help, you can verify the installation Correct

share picture

3. Quickly start using the locust module

Upon code:

Share pictures

share picture

4. New A class BlogDemo (TaskSet) inherits TaskSet. Below this class write some behaviors for preparing requests (access interfaces)
The self.client in it calls get and post methods, which are the same as requests
  @task decorates this Methods are expressed as user behaviors. The parameter in the brackets indicates the weight of the selection and execution of the behavior. The larger the value, the higher the execution frequency. If it is not set, the default is 1

5. The WebsiteUser() class is used to set the performance test.
  task_set: Point to a defined user behavior class.
  min_wait: The minimum value of the waiting time between tasks executed by the user, in milliseconds.
  max_wait: The maximum value of the waiting time between tasks executed by the user, in milliseconds.

6, start the locust script

   can directly start the script in pycharm

  [2019-10-21 18:56:23,879] DESKTOP-5GCGBAB/INFO /locust.main: Starting web monitor at *:8089
  [2019-10-21 18:56:23,879] DESKTOP-5GCGBAB/INFO/locust.main: Starting Locust 0.12.1

  在The pycharm console shows that the script has run successfully!

7. View the setting concurrency page

   Open the browser and input, because the machine starts 127.0.0.1 The browser input localhost:8089 (It has been shown that the port of locust is 8089 )

 share picture

The page will be displayed after opening

p>

8. Set concurrency

  Number of users to simulate Set the total number of virtual users

  Hatch rate (users spawned/second) The number of virtual users started per second

   Click Start swarming to start the performance test

share pictures

  Type: request type;

  Name: request path;

  requests: current number of requests;

p>

  fails: the number of failed requests;

  Median: the median value, in milliseconds. Generally, the server response time is lower than this value, and the other half is higher than this value;

< p>  Average: the average response time of all requests, in milliseconds;

  Min: the minimum server response time of the request, in milliseconds;

  Max: the maximum server response time of the request, in milliseconds;

  Content Size: the size of a single request, in bytes;

  reqs/sec: the number of requests per second

   click STOP to stop running< /p>

   Click Edit, a setting window will pop up, reset the number of concurrent users and the total number of users

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2608 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.