Apache JMeter Web Performance test instance

Source: Internet
Author: User
Tags ftp mail thread time interval web services

Apache JMeter is a tool that can test applications that use HTTP or FTP servers. It is java-based and is highly scalable through the provided APIs. Typical jmeter tests include creating loops and thread groups. Loops use a preset delay to simulate successive requests to the server. The thread group is designed to simulate concurrent load. JMeter provides a user interface. It also exposes APIs that allow users to run JMeter based tests from Java applications. To create a load test in jmeter, you need to build a test plan. In practice, JMeter needs to perform a series of operations. The simplest test plan typically includes the following components:

Thread groups--these components are used to specify the number of threads to run and the waiting period. Each thread simulates a user, and the wait period is used to specify when all threads are created. For example, the number of threads is 5 and the wait time is 10 seconds, and the time interval between each thread is created is 2 seconds. The number of loops defines the elapsed time of a thread. With the scheduler, you can also set the start time of the run.

Samplers--For server HTTP, FTP, or LDAP requests, these components are configurable requests. This tutorial focuses only on Web services requests.

Listeners-these components are used to request post-processing of data. For example, you can save data to a file or use a chart to illustrate the results. The JMeter chart does not offer many configuration options at this point, but it is extensible and can always add additional visualizations or data processing modules.

The Apache jmeter Web site gives a detailed description of the available components. In some cases, if the available components are not suitable for a particular test, the developer can write his or her own script or Java class and embed it in the test plan by placing a jar file in the \lib\ext\ directory where JMeter is installed.

The version we use in this article is JMeter 2.1. Download executable binaries from a Web site, unzip them, and then use the application on Windows or UNIX platforms. If you are working in a Windows operating system, go to the Bin folder to start the application with Jmeter.bat or Jmeterw.bat. The initial user interface is shown in Figure 1.

Figure 1: Starting Apache JMeter

Create a Load test

With the JMeter load test feature, you can generate high load on the server and determine its capacity and limitations. Note: To use Web services samples, you need available Mail.jar and Activation.jar, which can be obtained from Sun Microsystems (see the links below). Apache did not distribute these libraries due to authorization restrictions. After downloading the two jar files, put them in the Java classpath or install the JMeter lib directory.

Figure 2: Creating a thread group and basic Web Services test plan

Right-click Test plan now and add thread group and loop Controller. We use these two components to set the number of concurrent users to simulate and the duration of the test. Under the tree-like loop controller, add "WebService (SOAP) Request" and graph, as shown in Figure 2. If you cannot add a WebService request to a test plan, you may have no mail.jar or Activation.jar in the path.

Type the number of threads, wait periods, and loops. In this tutorial we use 5, 10, and 100, respectively. Set the loop controller count to 1. If the WebLogic server that is configured with Web services is still not running, either start it manually or start from WebLogic Workshop.

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.