jmeter the basis of actual performance test

I. Introduction

  "Paper come Zhongjue know this practice is essential." Studied theoretical knowledge to practical operation together. This paper describes the performance test basis jmeter combat.
Two, Jmeter the basis of actual performance test
  1. Testing Requirements: Test 20 users to access https://www.cnblogs.com/huainanhai/ average response time on the load reaches 30 QPS.
  QPS: Query Per Second queries per second rate: is a query server can handle the number of queries per second. On the Internet, a domain name system server performance is often measured by queries per second rate.
  2. Test steps:
   The first step: Adding a thread group
  The main thread group consists of three parameters: the number of threads, long (Ramp-Up Period (in seconds)) preparation cycles.
  • Threads: the number of virtual users. A virtual user occupies eleven process or thread. How many virtual users set up where the number of threads is set.
  • when the long preparation for the 10, then 10 seconds to start 20 threads. That is to start two threads per second.
  • Cycles: transmission request times for each thread. If the number of threads 20, 5 cycles, then 5 times each thread sends requests. The total number of requests is 20 * 5 = 100. If you check the "Always", then all threads will always send request until choose to stop running the script

  Step two: Increase the HTTP request

  A HTTP request with many configuration parameters, detailed below:

  ✧ Name: This attribute is used to identify a sampler, it is recommended to use a meaningful name.

  ✧ Note: For the test does not work, only the user-readable recording user comment information.

  ✧ server name or IP: HTTP request to the target server name or IP address sent.

  ✧ Port number: port number of the target server, the default value is 80.

  ✧Timeouts (milliseconds): Set the timeout request and response

  ✧ Protocol: send to the target server protocol HTTP requests may be http or HTTPS, the default value is http.

  ✧ Method: HTTP request method, available methods include GET POST HEAD PUT OPTIONS TRACE, DELETE, etc.......

  ✧Content encoding: encoding the content, the default value iso8859

  ✧ path: the target URL path (not including the server address and port)

  ✧ automatically redirects: If this option is selected, when the response after sending HTTP requests get is 302/301 when, JMeter automatically redirected to the new page.

  ✧Use keep Alive: When this option is selected, and the target server use between jmeter Keep-Alive mode (also known as persistent connections, connection reuse) HTTP communication is selected by default.

  ✧Use multipart / form-data for HTTP POST: When sending an HTTP POST request, so Use multipart / form-data transmitting method, not selected by default.

  ✧ transmission parameters together with the request (Send Parameters With the Request): URL parameters sent in the request. For the URL with parameters, jmeter provides a simple approach to parameterized. The user can set all the parameters in the URL in this table, each row in the table is a parameter value (corresponding to a name in the URL value = 1).

  ✧ same request - send a file with: send the file in the request, usually HTTP file upload behavior can be simulated in this way.

  ✧ Get all have the included resources from the HTML file: When this option is selected, jmeter in an HTTP request and obtain

After the response file HTML content, but also to analyze the HTML and get all the resources (images, flash, etc.) contained in HTML, not selected by default, if you just want to get a page of a particular resource, may URLs Embedded in the bottom of the fill need to download a specific resource must match the text box expression, so that only matches the specified regular expression URL points to a resource will be downloaded.

  ✧ as Monitor: This monitor sampler is as can be seen graphically based on the statistics of the sampler directly in Monitor Results Listener. The default is not selected.

  ✧Save response as MD5 hash:? Check this when performing only recording server response MD5 value of the data, but does not record the complete response data. When the need for a very large amount of data to test, it is recommended to select the records to reduce costs in response to the sampling data.

  tips: The default time in milliseconds; report output file suffix .jtl

  Step 3: Set QPS limit

  Jmeter provides a useful a timer, called Constant Throughput Timer (constant throughput timer), the timer can easily control the throughput of a given transmission request the sampler.

  The main attribute Constant Throughput Timer description:

  Target throughput (in samples per minute): target throughput. Note that this is the number of requests per minute, a value of the actual filling: 60 * QPS, followed Calculate Throughput based on: There are five options, namely:

  • This thread only: controlling the throughput of each thread, this mode is selected, the total throughput of the number of set target Throughput multiplied by the thread.
  • All active threads: target Throughput setting will be distributed on each active threads, each thread is active after the end of the last run to run again after waiting a reasonable time. Active thread threads from the same time running simultaneously.
  • All active threads (shared): All active threads and options basically the same, the only difference is that each thread will be active on all active threads running again after waiting a reasonable time after the end of a run.
  • on an active thread, when the test plan is only one thread group, this option is exactly the same effect and All active threads option.
  • All cative threads in current thread grotmy (shared): with All active threads in current thread group is basically the same, the only difference is that each active thread will run again after the end of waiting to run again after a reasonable period of time on all active threads.

  After 30 QPS conversion, Target throughput (in samples per minute: 30 * 60 = 1800)

   Step Four: Add Monitor

  After completion of setting of the main part of the script, the test results of the performance tests required to obtain in some way, in this embodiment, we are interested in the response time of the request.

  Jmeter using listener collector element sampled data and records in a visual way to present. Jmeter There are various types of listeners for the HTTP request, we can add a polymerization report, more intuitive view test results.

  Add polymerization report, right-click on the thread group, playing the menu (add ---> listener ---> Aggregate Report) Selection in the report.

  Add View Results Tree (add ---> listener ---> see the results tree)

  Step Five: Run the script

  Step Six: Aggregate Report Analysis

  20 users access https://www.cnblogs.com/huainanhai/  average response time on the load reaches 30 QPS is 1986ms

  The figure is reported performance metrics polymerization explanation (PS: response time unit is ms)

 

 

Guess you like

Origin www.cnblogs.com/huainanhai/p/12153738.html