JMeter stress test performance

1) test target site is fnng.cnblogs.com and tt-topia.rhcloud.com 2) the purpose of the test site response time when the load reaches 20 QPS. QPS explain QPS: Query Per Second queries per second rate. Is a query server the number of queries that can be processed per second. On the Internet, a domain name system server performance of the machine is often used to measure queries per second rate. In order to achieve the intended purpose of the test, we need to need to create a test plan in jmeter in. Because this test is only required to complete two of fnng.cnblogs.com and tt-topia.rhcloud.com blog page request, and therefore only need to use HTTP Request Sampler can be. After establishing a test program started jmeter, jmeter will automatically generate an empty test plan, test plan based on the user can create their own test plans. Adding a thread group performance test request load is based on a complete set of thread. A test plan must have a thread group. Test plans to add a thread group is very simple. In the test plan right pop-up drop-down menu (add -> Threads (Users) ---> thread group) can be selected in the thread group. jmeter each test plan needs to include at least one thread group, of course, you can create multiple threads in a group plan, then what will happen in the order execution (serial or parallel) between multiple threads groups? Here in the test plan a plurality of parallel execution threads, i.e. threads which are set at the same time is initialized and simultaneously execute the thread group Sampler. The main thread group consists of three parameters: the number of threads, long (Ramp-Up Period (in seconds)) When ready, the number of cycles. Threads: the number of virtual users. A virtual user occupies one process or thread. How many virtual users set up where the number of threads is set. When preparing long: the number of virtual users to set how long it takes all started. If the number of threads is 20, 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, 100 cycles, each thread 100 requests the transmission. The total number of requests is 20 * 100 = 2000. If you check the "Always", then all threads will always send a request to opt out of running a script. Set a reasonable number of threads have a decisive influence on the test can achieve the goal. In this case, the response time requirements are Home at 20 QPS load conditions, if the number is too small set of threads, it is likely not achieve the requirements set by QPS. In addition, a reasonable number of cycles is also important, in addition to a fixed number of cycles described above and never outside; you can also choose to set flexible test run time. Check "Scheduler" scheduling configuration. After adding HTTP request to add the group to complete the thread on the thread group context menu (add ---> Sampler ---> HTTP request) to select HTTP request. For jmeter, the sampler (Sampler) is a unit interacting with the server. A sampler operates generally three parts: the server sends a request to the recording server response data corresponding to the recording time information A HTTP request has many configuration parameters detailed below: Name: This attribute identifies a sampler recommended 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. Protocol: send to the target server protocol HTTP requests may be http or HTTPS, the default value is http. Method: The method of HTTP request, the available methods including GET, POST, HEAD, PUT, OPTIONS, TRACE, DELETE and the like. Content encoding: encoding the content, the default path is iso8859: target URL path (not including the server address and port) automatically redirects: If this option is selected, in response to an HTTP request when obtained is 302/301, the JMeter  Automatically redirected to the new page. Use keep Alive: When this option is selected, use the Keep-Alive HTTP communication between jmeter way and the target server is selected by default. Use multipart / from-data for HTTP POST: When sending an HTTP POST request, using Use multipart / from-data transmission method, not selected by default. Request together with the parameters: URL parameters sent in the request for a parameterized URL, JMeter provides a simple parametric method. The user can set all the parameters in the URL in this table, each row in the table is a value of the parameter (RUL corresponding to the name 1 = value 1). Together with a request to send the file: file transmission request, typically, HTTP file upload behavior can be simulated in this way. Get all have the included resources from the HTML file: After When this option is selected, jmeter in an HTTP request and get the response HTML content files, and also carried out the HTML Parse and get all the resources (images included in HTML, flash etc.), not selected by default, if you just want to get a page of a particular resource, may need to match the text box must fill in Embedded URLs below to download a specific resource expressions, so that only matches the specified regular expression URL resources will be directed to download . 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 data without recording a 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. Here we add two HTTP requests, respectively, and for sending a request for fnng.cnblogs.com tt-topia.rhcloud.com. The purpose of providing this QPS limit performance test requirements mentioned test is the "home blog understand the response time when the load reaches 20 is QPS", it is necessary to control the load transmission request for the blog page 20QPS. One possible method is to gradually adjust the number of threads in the test plan, and adding the calculated timer (the Timer) is a sampler (Sampler), so that the HTTP request the sampler emitted QPS is maintained at about 20. However, this method is time-consuming, need to go through several attempts to achieve; another method, QPS controlled entirely by setting a timer, once the response time of the sampler is changed (the network environment changes), it is necessary to re-adjust the timing device latency.   Jmeter provides a very useful timer, called the Constant Throughput Timer (constant throughput timer), the timer can easily control the throughput of a given transmission request the sampler. Right-click on fnng.cnblogs.com, the pop-up menu (add ---> Timer ---> Constant Throughput Timer) Select Constant Throughput Timer The main attribute Constant Throughput Timer description: Name: The name of the timer Target throughput (in samples per minute): target throughput. Note that this is the number of requests transmitted per minute, therefore, the corresponding test demand required 20 QPS, this value should be 1200. 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 is multiplied by the number of set target Throughput carry threads. 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 in current thread group: target Throughput setting will be allocated on a currently active thread in each group, and when the test plan is only one thread group, this option is exactly the same effect and All active threads option. 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. All cative threads in current thread group (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. As shown above, the only element acting fnng.cnblogs. com, set the timer Target throughput was 1200 / min (20 QPS), the set value All active threads Calculate Throughput based on the. Of course, Constant Throughput Timer only produce threads in the thread group in the case of a sufficient number of request makes sense, therefore, even if a value is set Constant Throughput Timer, may also be due to the lack of threads in the thread group number, or timer and other causes unreasonable overall QPS can not achieve the desired objectives. After adding the main part of the listener (The Listener) script setting is completed, 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, because 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. After completion of the polymerization report run the script, we have to run the script, describes the parameters of polymerization report later. Before running the script, we take a look at the parameter settings for each element: ---------------------------------- ----------------------------- thread group: 20 long preparation time:: the number of threads 10 cycles: 10 ------ -------------------------------------------------- ------- HTTP request: name: fnng.cnblogs.com. Server name or IP: fnng.cnblogs.com Port number: 80 Implementation:  the Java protocol: http method: GET Path: / ------------------------ --------------------------------------- constant throughput timer: Target throughput (in samples per minute): 1200.0 Calculate Throughput based on: All active threads ------------------------------------- -------------------------- click the run button on the toolbar, or click on the menu bar "run ---> start" or use the keyboard shortcut ctrl + r to run the program. The report analyzes the results of polymerization runs polymerization View reports:

Reproduced in: https: //my.oschina.net/wzlee/blog/262189

Guess you like

Origin blog.csdn.net/weixin_34060299/article/details/91716737