How apache/jmeter works
Apache JMeter is a multi-module Gradle monorepo for load testing. Its architecture is centered on a shared test-plan model, an execution engine, pluggable protocol samplers, and multiple result-processing paths for GUI, CLI, and reporting.
1. Core execution model
src/core contains the fundamental runtime: TestElement, HashTree-based test plans, thread groups, samplers, listeners, timers, assertions, config elements, and the StandardJMeterEngine. This is the main execution backbone used by both GUI and non-GUI runs.
2. Test plan lifecycle
A typical flow is: author or import a test plan, serialize it to JMX/XML, load it back into the tree model, precompile it, then execute it through JMeterThread instances. The engine resolves functions, variables, config merging, and scoped elements before sampling starts.
3. GUI subsystem
The Swing-based IDE lives mostly in src/core and src/components, with MainFrame, tree models, menus, actions, and many component-specific GUIs. It is not just a view layer: it is the primary editor for composing the test tree, controlling runs, viewing results, and launching report generation.
4. Protocol-specific samplers as plug-in modules
Protocol support is split into dedicated modules under src/protocol/*: HTTP, JDBC, JMS, FTP, LDAP, TCP, Java, JUnit, mail/SMTP, native/system, and Bolt. Each module contributes samplers, config elements, GUIs, parsers, and resources, and plugs into the same core Sampler/ConfigElement/Visualizer contracts.
5. HTTP stack as the largest protocol boundary
src/protocol/http is the most elaborate subsystem. It includes HTTP samplers, request builders, cookies, cache, auth, proxy/recording, HTML/CSS link extraction, curl parsing, and mirror-server support. This module is a full HTTP client/recording/correlation stack rather than a thin sampler wrapper.
6. Result collection and listeners
Samples flow from samplers into listeners and collectors in src/core and src/components. Important consumers include ResultCollector, Summariser, visualizers, and backend listeners. They can persist raw results, compute summaries, render live graphs, or forward metrics to external systems.
7. Reporting pipeline
The HTML dashboard/reporting system is in src/core/src/main/java/org/apache/jmeter/report/**. It reads sample logs, converts them into report data, runs aggregations and graph consumers, and emits static HTML/JSON dashboard artifacts. This is separate from the live GUI visualizers and is designed for post-run analysis.
8. Live metrics backends
src/components contains backend listeners for Graphite and InfluxDB. These modules transform sample events into time-series metrics and send them over network protocols, enabling external observability tools to visualize test execution in near real time.
9. Save/load and serialization layer
src/core/src/main/java/org/apache/jmeter/save handles JMX/XML persistence, CSV result I/O, and XStream-based converters. This layer is the boundary between in-memory test trees/results and disk artifacts such as test plans, result logs, and report inputs.
10. Remote/distributed execution
The engine supports remote test execution through RMI-related classes in src/core/src/main/java/org/apache/jmeter/engine and src/core/src/main/java/org/apache/jmeter/rmi. The client/remote engine split allows a controller node to launch and coordinate test threads on remote agents.
11. Functions, scripting, and extensibility
src/functions, src/components, and src/protocol/java provide a large function library and scriptable samplers/processors. JSR223, BeanShell, Groovy, regex/XPath/JSON extractors, and test bean infrastructure make the system extensible without changing the core engine.
12. Shared utility foundation
src/jorphan is the shared support library used across modules. It provides collections, GUI helpers, reflection/service loading, logging wrappers, math/statistics, I/O utilities, and legacy compatibility classes. Many higher-level modules depend on it for non-domain-specific behavior.
13. Launchers, packaging, and distribution
src/launcher contains startup entry points, while src/dist and src/dist-check verify assembled distributions. The top-level bin and lib directories define the runtime layout, scripts, examples, templates, and bundled resources used when JMeter is shipped or run from a distribution.
14. Build and test architecture
The repository is built with Gradle and uses many module-level test suites, fixtures, and benchmark sources (jmh). Mixed Java/Kotlin code appears in core domains such as schemas, DSL/tree building, open-model thread groups, and GUI bindings, indicating a gradual modernization layer over the older Java/Swing architecture.
Overall data flow: test plan authoring or import → model tree persistence → engine precompilation → threaded sampling against protocol modules → listeners/reporters/backends → saved results and optional dashboard generation.
Main entry points: components Components · testelement Core Model · engine Engine · jorphan JOrphan
Components 23
Foundation
Shared libraries and build/runtime support
- JOrphan · Common collections, GUI, reflection, I/O, math, logging, and service-loading utilities
src/jorphan - Build Logic · Shared Gradle plugins and build conventions used across modules
build-logic - Test Kits · Reusable test fixtures and support modules for integration and extension testing
src/testkit
Runtime
Core test-plan model, engine, GUI, save/load, and reporting
- Core Model · TestElement hierarchy, properties, thread groups, samplers, timers, and core abstractions
src/core/src/main/java/org/apache/jmeter/testelement - Engine · Precompilation, thread orchestration, remote execution, and runtime sampling control
src/core/src/main/java/org/apache/jmeter/engine - Threads · JMeterThread, thread groups, compiler, variables, and execution-scoped context
src/core/src/main/java/org/apache/jmeter/threads - Save/Load · JMX/XML persistence, CSV result I/O, and object converters
src/core/src/main/java/org/apache/jmeter/save - Swing GUI · MainFrame, tree model, actions, and component editors for composing and running plans
src/core/src/main/java/org/apache/jmeter/gui - Reporting · HTML dashboard generation, sample readers, aggregations, and graph consumers
src/core/src/main/java/org/apache/jmeter/report - Listeners · ResultCollector, Summariser, visualizers, and listener infrastructure for sample events
src/core/src/main/java/org/apache/jmeter/reporters - Functions · Built-in functions, variable expansion, scripting hooks, and helper utilities
src/functions - Components · Shared assertions, extractors, controllers, timers, visualizers, backend listeners, and GUI bindings
src/components
Protocols
Pluggable samplers and protocol-specific integrations
- HTTP · HTTP samplers, proxy/recording, parsing, auth, cookies, cache, curl import, and mirror server
src/protocol/http - JDBC · Database samplers, datasource config, and JDBC pre/post processors
src/protocol/jdbc - JMS · JMS publisher/subscriber samplers, message renderers, and client pooling
src/protocol/jms - Java · Java, BeanShell, BSF, JSR223, and JUnit sampler entry points
src/protocol/java - LDAP · LDAP and LDAP-ext samplers with config GUIs
src/protocol/ldap - Mail/SMTP · Mail reader and SMTP samplers plus mail transport support
src/protocol/mail - TCP · TCP sampler, client implementations, and configuration GUIs
src/protocol/tcp - System · Native/system command sampler and GUI
src/protocol/native - Bolt · Bolt connection config and sampler plugin
src/protocol/bolt
Delivery
Launchers, packaging, examples, and distribution assets
- Launcher · Main launchers and shutdown client used to start JMeter runtimes
src/launcher - Distribution · Distribution checks, release jars, scripts, templates, and bundled runtime layout
src/dist
Connections 31
- Build Logic → Core Model: builds · Applies shared conventions to core sources
- Build Logic → Components: builds · Applies shared conventions to components module
- Build Logic → HTTP: builds · Applies shared conventions to protocol modules
- JOrphan → Core Model: supports · Provides collections, utilities, and reflection helpers used by core runtime
- JOrphan → Swing GUI: supports · Provides tree/table widgets and GUI utilities
- JOrphan → Save/Load: supports · Provides XML and serialization helpers
- JOrphan → Reporting: supports · Provides shared data structures and utilities for report processing
- Core Model → Engine: drives · Defines the test tree and runtime elements executed by the engine
- Core Model → Threads: compiled by · Test plan elements are compiled into execution packages for threads
- Save/Load → Core Model: persists · Serializes and restores test plans and test elements
- Swing GUI → Core Model: edits · Builds and manipulates the test-plan tree
- Swing GUI → Engine: runs · Starts, stops, and controls execution
- Listeners → Reporting: feeds · Sample logs and result collectors provide inputs for post-run reporting
- Engine → Threads: spawns · Creates and coordinates JMeterThread execution
- Threads → Components: uses · Thread execution invokes samplers, timers, assertions, and processors
- Components → Listeners: emits · Listeners and visualizers consume sample events and results
- Functions → Engine: expands · Function resolution and variable substitution happen during precompilation and execution
- Functions → Components: extends · Scripting and helper functions are used by processors and samplers
- HTTP → Components: implements · Provides HTTP samplers, config elements, and GUI plug-ins
- JDBC → Components: implements · Provides JDBC samplers and supporting components
- JMS → Components: implements · Provides JMS samplers and renderers
- Java → Components: implements · Provides scriptable and Java-based sampler extensions
- LDAP → Components: implements · Provides LDAP samplers and configuration UI
- Mail/SMTP → Components: implements · Provides mail and SMTP protocol samplers
- TCP → Components: implements · Provides TCP protocol support
- System → Components: implements · Provides native command execution sampler
- Bolt → Components: implements · Provides Bolt protocol sampler support
- Launcher → Engine: starts · Bootstraps the runtime and launches controller or server modes
- Distribution → Launcher: packages · Assembles runnable distribution layout and scripts
- Distribution → Reporting: includes · Ships dashboard templates and report resources
- Swing GUI → Reporting: invokes · Launches HTML report generation from the desktop UI