Performance Testing Tools-----Jmeter

Source: Internet
Author: User
Tags ftp http request mysql database
Jmeter a ' Jmeter profile Apache Jmeter is Apache, open source. Pure Java Desktop App installation configuration JDK download installation jmeter tool composition and thread groupsResource Builder: The resource code used to generate the server and the load machine during the test. User runner (Vugen in LR): Typically a script run engine that emulates specified user behavior according to script requirements. (Controller in LR) Report Builder: Generates reports based on real-time data in the test, providing a visual display of the data. (Analysis in LLR) load generators: Used to generate loads, typically simulating user behavior in a multi-line and multi-process manner. (LR in load generators)
Test plan: Used to crawl and describe a performance test that includes all the relevant features associated with this performance test. It is said that all the content of the performance test is based on a plan. (equivalent to a test scenario for LR)
A.setup Thread Group A special type of threadgroup that can be used to perform a predictive pilot operation. These threads behave exactly like a normal thread-group component. The difference is that these types of threads perform a regular thread group execution before testing. The LR-like init () B.tharddown thread Group is a special type of threadgroup that can be used to perform post-test actions. These threads behave exactly like a normal thread-group component. The difference is that these types of threads execute a regular thread group after the test results are executed. End () c.thread group (thread group) in type LR This is the thread that we add to the run. Can be seen as a virtual user group, and each thread in a thread group can be understood as a virtual user. The number of threads contained in a thread group does not change during test execution. Action similar to LR () JMeter Executable ComponentsThe test fragment test fragment element is a special group of threads on the controller that is at the same level as the thread group on the test tree. It differs from the thread group because it is not executed. It is executed only if it is an analog controller or is referenced by the controller.
Class 8 Executable components Configuring ComponentsConfiguration components (config dlement) are used to provide support for static data configuration. For example, CSV Data set config can form a local Reiki file into a data pool.
Timers (timer)Timers are used to set the wait time between operations, and the wait time is a common means of controlling the client's QPS in performance testing. The "Think Time" type in LR. JMETERP defines different types of timers, such as bean Shell Timer, Constant throughput timer\ apps fixed timer, and so on.
predecessor processor (Per processors)For special handling of incoming requests before the actual request is issued. For example, an HTTP URL rewrite fix could implement a URL rewrite that could populate the actual SessionID that made the request with the SessionID class of session information in the URL. Post Processor (post processors)Used to process a server response from a request made by the sampler. Typically used to extract specific data in a response (similar to the concept of association in a LoadRunner test tool).
Assertion (assertions)Assertions are used to check whether the corresponding data obtained in the test is compliant, and assertions are typically used to set checkpoints to keep the data interactions in the performance test as expected. Listeneris a series of components used to process and visualize the results of a job without a say. Graphical results, viewing result trees, aggregated reports. Are all of the components we often use. Note: This listener is not a component that listens to system resources.
Sampler (sample)The sampler (sample) is a performance transfer to the server to send requests, record response information, record the minimum unit of response time, jmeter native support many different Sampler, such as HTTP request Sampler, FTP request Sampler, TCP Request Smpler, JDBC request Ssampler, and so on, each of the different types of sampler can make different types of requests to the server based on the parameters set.
Logical controller logic Controller, consisting of two types of components, is a controller used to control the logical order of the sampler node sending requests in Test plan, commonly used if (if) controller, switch controller\runtime controller\ loop control The other is used to organize the sampler to control the node. such as transaction controller, throughput controller.
JMeter Script Recording Badbod jmeter script recording http://wwwbadboy.com.au Badboy is a powerful tool to refer to in the help of testing and beginning complex dynamic applications. Badboy includes a simple and comprehensive capture/playback interface, support for Chang Lei load testing, detailed report graphs, and more, making web testing and development easier.
jmeter element scope and execution order 1. Component Scope8 classes of components that can be executed (the test plan and the process group are not part of the component to be executed), in which the sampler (sampler) is a typical component that does not interact with other components, the sampler for its child nodes is valid in the logic controller, and the other components (configuration components, timers, assertions, listeners) need to be with the sampler (sampler) and other component interactions. In JMeter, the scope of the component is determined by the parent-child relationship of the element in the tree structure of the test plan, the principle of the scope is: the Sampler (sampler) No piece does not interact with other components, so the problem is not cloth in the scope of the sample and logic controller components, in addition to the other 5 types of components, If it is a child node of a sampler, the component works on its parent-child node. If the parent node is not a sampler, its scope is all other descendant nodes (including child nodes, child nodes, and so on) under the parent node of the component. 2, component execution sequence (1) configuration element (config elements) (2) Pre-processor (Per-processors) (3) Timer (timers) (4) Sampler (sampler) (5) Post-processing program (Post-processors) (6) Assertion (assertions) (7) Listener (Listeners)
There are two points to note about the execution sequence:
Component functions such as the predecessor processor, the post processor, and the assertion function on the sampler, so if there are no samplers within their scope, they will not be executed.
If there are multiple elements of the same type within the same scope, the components are executed sequentially in the order they were in the test plan. Vii. jmeter Performance Test Basic Combat 1, test requirements: Test 20 user access to the http://www.51zxw.net at load up to 30QPS average response time. Qps:puery per Second query rate. is the number of queries that a query server can process per second. On the Internet, performance as a domain Name System server is often measured by the query rate per second.
Test step The first step: The Add Thread Group thread group consists of three parameters: number of threads, length of preparation (ramp-up Period (in seconds)), number of cycles. Number of threads: number of virtual users. A virtual user occupies a process or thread. Setting up multiple virtual users here is the number of threads to set. Preparation time (in s): The number of virtual users that are set up takes a long time to start all. If the number of threads is 20 and the preparation time is 10, then 10 seconds are required to start 20 threads. That is, it starts 2 threads per second.

Parameterization of JMeter
Jmeter meeting Point and associated Jmeter FTP server connection
Jmeter MySQL test prepare a MySQL database with test data table in the Test Plan panel, click the "Browse ..." button to add your JDBC driver.

1. Test Plan Browse Mysql-connector-java-5.1.43.jar
2. Add a thread group--add--and configure the component "JDBC Connection Configuration".
3. Fill in the database configuration information
4. Add "JDBC Request"

JMeter distributed test background because of the bottleneck of the jmeter itself, when it comes to simulating thousands of concurrent users, it is a bit of a problem to simulate all the development users with a single machine, and even a Java memory overflow error. To solve this problem, use distributed testing, multiple machines running so-called agents to share the pressure of JMeter itself, and take this to obtain a larger number of concurrent users, but need to make some relevant changes, as follows. Operation Step 1, install JMeter, and determine one of the machines as controller, other machines as agents. Then run all The Jmeter-server.bat file on the agent machine-----Assume that we use two machines 192.168.0.11 and 192.168.0.12 as agents; (You must install the JDK on the agent machine and set the environment variable) 2, Under controller machine%jmeter_home%/bin, edit "remote_hosts = 127.0.0.1" in Jmeter.properies. The 127.0.0.1 represents the machine running the JMeter agent, which needs to be modified to ' remote_hosts=192.168.0.11:1099,192.168.0.12:1099 '------where 1099 is the port number. 3. Start the Jmeter.bat on the controller machine, select the 192.168.0.11:1099 and 192.168.0.12:1099 in "Remote Start" in the menu run to operate the agent. 4, if you want to allow a computer to execute, you can click on the computer's IP address can be, if two are to execute, you can click on the Run Menu "remote Run All" menu. 5, sometimes used as a proxy machine too little, still can not meet the needs, you need to be a controller of the computer also as an agent, you also need to modify the Jmeter.properities file, the controller's IP address to write. At the same time, you need to open the controller computer in the JMeter under the Bin directory Jmeter-server.bat, and then open, and then open Jmeter.bat. At this point, go to the Run->remote Start menu, You can see that the controller is also running as a remote machine. FAQ: 1, to determine on the controller machine installed JDK version and jmeter consistent 2, agent machine startup Jmeter_server.bat, background prompt: "Could not find Apachejmeter_core.jar "Workaround: This is open mom did not find Apachejmeer_core.jar, if you do not want to see could not find the words, you need to add environment variables Jmeter_ HOME, the path is the top-level directory of the bin directory, so when you start the Jmeter-server service, you will not see could not Found Apachejmeter_core.jar. 3. JMeter distributed Control process, the number of threads started by each aent equals the configuration in the thread group.
JMeter Java Engineering Test

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.