Convert Figma logo to code with AI

apache logojmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services

8,235
2,084
8,235
868

Top Related Projects

6,397

Modern Load Testing as Code

24,772

Write scalable load tests in plain Python 🚗💨

23,459

HTTP load testing tool and library. It's over 9000!

24,954

A modern load testing tool, using Go and JavaScript - https://k6.io

Quick Overview

Apache JMeter is an open-source Java application designed for load testing and measuring performance of various services, with a focus on web applications. It can simulate heavy loads on servers, networks, or objects to test their strength and analyze overall performance under different load types.

Pros

  • Highly extensible and customizable through plugins and scripting
  • Supports a wide range of protocols, including HTTP, HTTPS, FTP, JDBC, and more
  • Provides a user-friendly GUI for test plan creation and a CLI for running tests
  • Offers comprehensive reporting and result analysis features

Cons

  • Can be resource-intensive, especially for large-scale tests
  • Learning curve can be steep for advanced features and scenarios
  • GUI can become slow when dealing with very large test plans
  • Limited support for modern web technologies like WebSocket

Code Examples

  1. Creating a simple HTTP request:
import org.apache.jmeter.protocol.http.sampler.HTTPSampler;
import org.apache.jmeter.config.Arguments;

HTTPSampler httpSampler = new HTTPSampler();
httpSampler.setDomain("example.com");
httpSampler.setPath("/api/users");
httpSampler.setMethod("GET");
  1. Adding a header to the request:
import org.apache.jmeter.protocol.http.control.Header;
import org.apache.jmeter.protocol.http.control.HeaderManager;

HeaderManager headerManager = new HeaderManager();
headerManager.add(new Header("Content-Type", "application/json"));
httpSampler.setHeaderManager(headerManager);
  1. Creating a loop controller:
import org.apache.jmeter.control.LoopController;

LoopController loopController = new LoopController();
loopController.setLoops(5);
loopController.addTestElement(httpSampler);

Getting Started

To get started with Apache JMeter:

  1. Download JMeter from the official Apache website.
  2. Extract the archive to your desired location.
  3. Run JMeter by executing bin/jmeter.sh (Unix) or bin\jmeter.bat (Windows).
  4. In the GUI, create a new Test Plan:
    • Right-click on "Test Plan" > Add > Threads > Thread Group
    • Right-click on "Thread Group" > Add > Sampler > HTTP Request
    • Configure your HTTP request details
    • Right-click on "Thread Group" > Add > Listener > View Results Tree
  5. Save your Test Plan and run it using the "Start" button or in non-GUI mode:
    jmeter -n -t your_test_plan.jmx -l results.jtl
    

This will execute your test plan and save the results in the results.jtl file.

Competitor Comparisons

6,397

Modern Load Testing as Code

Pros of Gatling

  • Higher performance and scalability due to its asynchronous, non-blocking architecture
  • More developer-friendly with Scala-based DSL for test scripting
  • Built-in support for real-time reporting and analytics

Cons of Gatling

  • Steeper learning curve, especially for those unfamiliar with Scala
  • Smaller community and ecosystem compared to JMeter
  • Limited GUI support, primarily relies on code-based test creation

Code Comparison

JMeter (XML-based):

<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
  <stringProp name="HTTPSampler.domain">example.com</stringProp>
  <stringProp name="HTTPSampler.port">80</stringProp>
  <stringProp name="HTTPSampler.protocol">http</stringProp>
  <stringProp name="HTTPSampler.path">/api/users</stringProp>
  <stringProp name="HTTPSampler.method">GET</stringProp>
</HTTPSamplerProxy>

Gatling (Scala-based):

http("Get Users")
  .get("http://example.com/api/users")
  .check(status.is(200))

Both JMeter and Gatling are popular open-source load testing tools, but they differ in their approach and target audience. JMeter offers a more traditional, GUI-based testing experience with broad protocol support, while Gatling focuses on high performance and a code-centric approach. The choice between them often depends on the team's expertise, project requirements, and performance needs.

24,772

Write scalable load tests in plain Python 🚗💨

Pros of Locust

  • Written in Python, making it more accessible for developers familiar with the language
  • Supports distributed load testing out of the box
  • Allows for more flexible and customizable test scenarios using Python code

Cons of Locust

  • Limited reporting capabilities compared to JMeter's extensive reporting options
  • Smaller community and ecosystem, resulting in fewer plugins and extensions
  • Steeper learning curve for non-programmers or those unfamiliar with Python

Code Comparison

Locust:

from locust import HttpUser, task, between

class WebsiteUser(HttpUser):
    wait_time = between(1, 5)

    @task
    def index_page(self):
        self.client.get("/")

JMeter (XML configuration):

<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP Request" enabled="true">
  <stringProp name="HTTPSampler.domain">example.com</stringProp>
  <stringProp name="HTTPSampler.protocol">http</stringProp>
  <stringProp name="HTTPSampler.path">/</stringProp>
  <stringProp name="HTTPSampler.method">GET</stringProp>
</HTTPSamplerProxy>

The code comparison shows that Locust uses Python code to define test scenarios, while JMeter relies on XML configuration files. This difference highlights Locust's flexibility and ease of use for developers comfortable with Python, but may present a challenge for those more familiar with GUI-based tools like JMeter.

23,459

HTTP load testing tool and library. It's over 9000!

Pros of Vegeta

  • Lightweight and fast, with minimal resource usage
  • Simple command-line interface for quick load testing
  • Easy to integrate into CI/CD pipelines

Cons of Vegeta

  • Limited GUI options compared to JMeter's extensive interface
  • Fewer built-in protocols and test types supported
  • Less comprehensive reporting and analysis features

Code Comparison

Vegeta (Go):

rate := vegeta.Rate{Freq: 100, Per: time.Second}
duration := 5 * time.Second
targeter := vegeta.NewStaticTargeter(vegeta.Target{
    Method: "GET",
    URL:    "http://example.com",
})
attacker := vegeta.NewAttacker()

for res := range attacker.Attack(targeter, rate, duration, "Big Bang!") {
    // Process results
}

JMeter (Java):

StandardJMeterEngine jmeter = new StandardJMeterEngine();
HashTreeHandler testPlanTree = new HashTreeHandler();
testPlanTree.add(new TestPlan("Create JMeter Script"));
testPlanTree.add(new ThreadGroup());
testPlanTree.add(new HTTPSampler("http://example.com"));
jmeter.configure(testPlanTree);
jmeter.run();

Both tools offer load testing capabilities, but Vegeta focuses on simplicity and command-line usage, while JMeter provides a more comprehensive suite of features and a GUI. Vegeta is ideal for quick, programmatic load tests, whereas JMeter excels in complex, scenario-based testing with extensive reporting options.

24,954

A modern load testing tool, using Go and JavaScript - https://k6.io

Pros of k6

  • Modern JavaScript-based scripting for test scenarios
  • Cloud-native architecture with better scalability
  • Built-in support for various protocols (HTTP/2, WebSocket, gRPC)

Cons of k6

  • Smaller ecosystem and community compared to JMeter
  • Limited GUI options for test creation and management
  • Fewer built-in listeners and result analyzers

Code Comparison

k6 script example:

import http from 'k6/http';
import { check } from 'k6';

export default function() {
  let res = http.get('https://test.k6.io');
  check(res, { 'status is 200': (r) => r.status === 200 });
}

JMeter script example (in XML):

<HTTPSamplerProxy>
  <stringProp name="HTTPSampler.domain">test.jmeter.apache.org</stringProp>
  <stringProp name="HTTPSampler.protocol">https</stringProp>
  <stringProp name="HTTPSampler.path">/</stringProp>
  <stringProp name="HTTPSampler.method">GET</stringProp>
</HTTPSamplerProxy>

Both k6 and JMeter are powerful load testing tools, but they cater to different user preferences and use cases. k6 offers a more developer-friendly approach with its JavaScript-based scripting and cloud-native design, making it suitable for modern, scalable applications. JMeter, on the other hand, provides a more comprehensive set of features and a larger ecosystem, which can be beneficial for complex testing scenarios and integration with existing tools.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Apache JMeter logo

An Open Source Java application designed to measure performance and load test applications.

By The Apache Software Foundation

Build Status codecov License Stack Overflow Maven Central Javadocs Twitter

What Is It?

Apache JMeter can measure performance and load test static and dynamic web applications.

It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

JMeter screen

Features

Complete portability and 100% Java.

Multi-threading allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.

Protocols

Ability to load and performance test many applications/server/protocol types:

  • Web - HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET,...)
  • SOAP / REST Webservices
  • FTP
  • Database via JDBC
  • LDAP
  • Message-oriented Middleware (MOM) via JMS
  • Mail - SMTP(S), POP3(S) and IMAP(S)
  • Native commands or shell scripts
  • TCP
  • Java Objects

IDE

Fully featured Test IDE that allows fast Test Plan recording (from Browsers or native applications), building and debugging.

Command Line

Command-line mode (Non GUI / headless mode) to load test from any Java compatible OS (Linux, Windows, Mac OSX, ...)

Reporting

A complete and ready to present dynamic HTML report

Dashboard screenshot

Live reporting into 3rd party databases like InfluxDB or Graphite

Live report

Correlation

Easy correlation through ability to extract data from most popular response formats, HTML, JSON, XML or any textual format

Highly Extensible Core

  • Pluggable Samplers allow unlimited testing capabilities.
  • Scriptable Samplers (JSR223-compatible languages like Groovy).
  • Several load statistics can be chosen with pluggable tiers.
  • Data analysis and visualization plugins allow great extensibility and personalization.
  • Functions can be used to provide dynamic input to a test or provide data manipulation.
  • Easy Continuous Integration via 3rd party Open Source libraries for Maven, Gradle and Jenkins.

The Latest Version

Details of the latest version can be found on the JMeter Apache Project web site

Requirements

The following requirements exist for running Apache JMeter:

  • Java Interpreter:

    A fully compliant Java 17 Runtime Environment is required for Apache JMeter to execute. A JDK with keytool utility is better suited for Recording HTTPS websites.

  • Optional jars:

    Some jars are not included with JMeter. If required, these should be downloaded and placed in the lib directory

    • JDBC - available from the database supplier
    • JMS - available from the JMS provider
    • Bouncy Castle - only needed for SMIME Assertion
  • Java Compiler (OPTIONAL):

    A Java compiler is not needed since the distribution includes a precompiled Java binary archive.

    Note that a compiler is required to build plugins for Apache JMeter.

Installation Instructions

Note that spaces in directory names can cause problems.

  • Release builds

    Unpack the binary archive into a suitable directory structure.

Running JMeter

  1. Change to the bin directory
  2. Run the jmeter (Un*x) or jmeter.bat (Windows) file.

Windows

For Windows, there are also some other scripts which you can drag-and-drop a JMX file onto:

  • jmeter-n.cmd - runs the file as a non-GUI test
  • jmeter-n-r.cmd - runs the file as a non-GUI remote (client-server) test
  • jmeter-t.cmd - loads the file ready to run it as a GUI test

Documentation

The documentation available as of the date of this release is also included, in HTML format, in the printable_docs directory, and it may be browsed starting from the file called index.html.

Reporting a bug/enhancement

See Issue Tracking.

Build instructions

Release builds

Unpack the source archive into a suitable directory structure. Most of the 3rd party library files can be extracted from the binary archive by unpacking it into the same directory structure.

Any optional jars (see above) should be placed in lib/opt and/or lib.

Jars in lib/opt will be used for building JMeter and running the unit tests, but won't be used at run-time.

This is useful for testing what happens if the optional jars are not downloaded by other JMeter users.

If you are behind a proxy, you can set a few build properties in ~/.gradle/gradle.properties for Gradle to use the proxy:

systemProp.http.proxyHost=proxy.example.invalid
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=your_user_name
systemProp.http.proxyPassword=your_password
systemProp.https.proxyHost=proxy.example.invalid
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=your_user_name
systemProp.https.proxyPassword=your_password

Test builds

JMeter is built using Gradle, and it uses Gradle's Toolchains for JVM projects for provisioning JDKs. It means the code would search for the needed JDKs locally, or download them if they are not found.

By default, the code would use JDK 17 for build purposes, however it would set the target release to 8, so the resulting artifacts would be compatible with Java 8.

The following command builds and tests JMeter:

./gradlew build

If you want to use a custom JDK for building you can set -PjdkBuildVersion=11, and you can select -PjdkTestVersion=21 if you want to use a different JDK for testing.

You can list the available build parameters by executing

./gradlew parameters

If the system does not have a GUI display then:

./gradlew build -Djava.awt.headless=true

The output artifacts (jars, reports) are placed in the build folder. For instance, binary artifacts can be found under src/dist/build/distributions.

The following command would compile the application and enable you to run jmeter from the bin directory.

Note that it completely refreshes lib/ contents, so it would remove custom plugins should you have them installed to lib/. However, it would keep lib/ext/ plugins intact.

./gradlew createDist

Alternatively, you could get Gradle to start the GUI:

./gradlew runGui

Developer Information

Building and contributing is explained in details at building JMeter and CONTRIBUTING.md. More information on the tasks available for building JMeter with Gradle is available in gradle.md.

The code can be obtained from:

Licensing and Legal Information

For legal and licensing information, please see the following files:

Cryptographic Software Notice

This distribution may include software that has been designed for use with cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See https://www.wassenaar.org/ for more information.

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

The following provides more details on the included software that may be subject to export controls on cryptographic software:

Apache JMeter interfaces with the Java Secure Socket Extension (JSSE) API to provide

  • HTTPS support

Apache JMeter interfaces (via Apache HttpClient4) with the Java Cryptography Extension (JCE) API to provide

  • NTLM authentication

Apache JMeter does not include any implementation of JSSE or JCE.

Thanks

Thank you for using Apache JMeter.

Third party notices

  • Notice for mxparser:

    This product includes software developed by the Indiana University Extreme! Lab. For further information please visit http://www.extreme.indiana.edu/