"Turn" Jmeter: graphical interface pressure test tool

Source: Internet
Author: User

Jmeteris a powerful graphical interface pressure testTools, completely written in Java, about JMeter introduction, online actually have a lot of article, I originally did not want to repeat the similar article, but I found that some very important, in our test will be used in some of the settings or operations rarely see the article written clearly, such as there is a common problem: how to stress test a site multiple links? Because normally, we are not testing a link, if we are testing a site, and these links we are usually written to a text file, the test process, will randomly read the link in the file for stress testing, we are familiar with some of the stress testing tools,  For example, siege can do this. During my use of jmeter, I found myself surrounded by colleagues who had used jmeter before, but even so, they were not clear about how to write multiple links to a text file and read them randomly, so I'm going to write an article like this when I'm free to make it easier for users. First, the official websitehttp://jakarta.apache.org/jmeter/ second, the OperationAfter the download decompression, in the directory Jakarta-jmeter-2.4\bin can see a jmeter.bat file, double-click the file, open the initial interface such as: Note that the above is displayed in Chinese, if you want to use other languages, such as English, then through the menu options, Choose the language--English, of course, to Chinese is also the same operation. three, to run the pre-preparation   We're going to do a pair of monkey blogs now. Stress testing, the stress test object is a random number of web links, these links are written in a text file, the stress test will be randomly read. 1.   Set up a thread group, such as why to set up a thread group?  The reason is simple because we want to simulate multiple threads (users) to access the site.  Thread Group creation interface such as: name can be filled in, the default check "continue". In the Thread Properties section, the number of threads is how many threads are started, and what I'm filling out here is 60,ramp-up Period (in seconds) that indicates how much time between threads is allowed, in seconds, for example, if you fill in 120, then 120/60=  2 indicates that the Web site is requested every 2 seconds between 60 threads.  Number of cycles: 60 threads run Complete is one time, the number of cycles is such a request process to run how many times, I fill in the 1000.  Do not forget to save once you have modified one setting. 2,   set up the request server, pressure link and so on the next very natural, we want to test the website address is what? What is a link?  So now we're going to set up this information. Right click on the thread group that we just created, in the popup menu, choose Add->sampler->http request, pop up like interface: Name: Free to fill in the comments: Optional server name or IP: I fill in the zihou.me port number here: I fill in the Timesou  The T section can not fill in the HTTP request part of the protocol: HTTP, method I chose Get,content encoding I filled out is UTF-8. Path: Here is the path that is worth mentioning, if you are just a stress test of a link, then here is very simple, you can directly fill out a link is enough, such as http:// Www.zihou.me, but in many cases this is not the case, we need multiple links here, as we have just started, we want to save multiple links to a text file, and then randomly read the stress test. We can do this, open the interface, such as: Select _stringfromfile in the Select a feature drop-down list, and then create a new test file in this machine Text.txt, in the first line (you can also not be the first row) of the value of the test file, such as: then click the "Generate" button, In the left text box of the Build button, a string such as: ${__stringfromfile (E:\test\test.txt,,,)} in the test file, we write a URL link in each line, in the following format: 2011/03/26/3054 2011/03/ 26/3052 2011/03/26/3042 2011/03/25/3040 2011/03/25/3034 2011/03/24/3027 Note that there is no HTTP////in front of each line Www.zihou.me such information, because we have already filled in the server address is zihou.me, here there is no need to fill in the same prefix for each URL, and the above URL format is just an example of the domain name after the part, but many times the URL followed by the parameters, such as HTTP  ://www.zihou.me/p?a=1&b=3, if this is the case, then the above link can be written as: a=1&b=3 in this form.  Now we can fill in the previously mentioned path, as follows:/${__stringfromfile (E:\test\test.txt,,,)} Thus, when we are not requested, we will randomly select the URL from the Test.txt to carry out the stress test.  Another notable place is that if the parameters in the case of Chinese, the runtime may be garbled, this time you need to note that your encoding settings in the JMeter and the page encoding you want to request is consistent.  The options below the path text box can be made by default, and use Multipart/form-data for HTTP post is the case when there are attachments in the request, which is not normally checked. Send parameters together with the request section: If you are just a fixed page of stress testing, then you can not do the above mentioned in the text file to set the URL in the process, directly here to set the line, where the name is the parameter name, the value is the parameter value, add it here is OK,  But if you are stress multiple links, then here you can not fill. 3, look at the running results above set up, then it is natural to think how to view the results of the operation?  JMeter provides a number of ways to view this, in tabular form, curved form, and so on, and I personally think it is enough to view the form!   Right-click on the thread group, select Add-a listener in the popup menu, such as: Popup interface such as: Of course, you can also choose other viewing methods, you can also see in the Listener menu, there are several ways. Four, the OperationWell, now we can finally run!  Select menu item Run-to-start, such as: Of course, before running, you have to save all the changes.  The result table is as follows: Each property is as follows: Sample: Sequence number for each request start time: Each request starts at thread name: name of each thread label:http request name Sample time: Per request, in milliseconds  Status: The request state, if the tick indicates success, if the fork represents a failure.  Bytes: Number of bytes requested if the status is a fork, it is clear that the request is a failure, but if it is a tick, it is not considered that the request must be completely successful, because it depends on whether the number of bytes in the Bytes is the normal size of the requested Web page, or if it is not the case, it is not completely successful.  Here are a few more parameter samples: that is, the number of requests mentioned above, the success of the case equals the number of concurrent numbers you set multiplied by the number of cycles.  Average: Average time per thread request Latest Sample: Indicates the time deviation of the server's response to the last request: the change in response time of the server, the size of the discrete measure, or, in other words, the distribution of the data (which I don't quite understand).  In the above parameters, I personally think that just look at the status and bytes these two is enough.  Well, the main introduction so much, in fact, the scope of JMeter do stress testing far more than the web, it can also be used for Java Small service programs, CGI scripts, Java objects, databases, FTP servers and so on, more use can be based on their own needs to research and master. The last point is: You must have noticed that the HTTP request and result view are created under the Thread Group node, in fact, you can not necessarily be created under the thread group, you can build under the test plan, but create a thread group below can make our test intentions at a glance, That is, our HTTP request and result view are based on the thread group we set.

"Turn" Jmeter: graphical interface pressure test tool

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.