Apache JMeter
The JVM load-testing workhorse: thread groups, samplers, listeners, and protocol support well beyond HTTP. Interviewers ask because its GUI-versus-CLI usage and result interpretation come up in any performance-testing discussion.
on this pageshowhide
guide
overview
~1 minApache JMeter is a Java desktop-and-command-line tool for generating load: you assemble a test plan as a tree of elements, and at run time every simulated user walks that tree on its own thread, sending requests and recording what came back. Interviewers ask about it because it is still the default load tool in many teams, and because a JMeter answer quickly shows whether a candidate understands load testing or only the tool's menus. The strong answer explains what a run can and cannot prove, not just which field to fill. The hub follows the life of a test. [Plan composition](/topics/dev-jmeter-plan) covers the element families and the scoping rules that decide what applies where. [Load shaping](/topics/dev-jmeter-load) is how many users exist and how fast they act; [dynamic values](/topics/dev-jmeter-data) is how each user sends realistic, changing data; [sample verdicts](/topics/dev-jmeter-verify) is how a request is judged pass or fail. Running it at scale is [headless execution](/topics/dev-jmeter-execution) and [multi-engine runs](/topics/dev-jmeter-distributed); reading it is [run output](/topics/dev-jmeter-results). [Custom behaviour](/topics/dev-jmeter-scripting) and [protocol coverage](/topics/dev-jmeter-protocols) mark the edges of what the stock tool does, and [pipeline fit](/topics/dev-jmeter-pipeline) asks how a run becomes a build verdict and when a code-first runner suits better. Junior rounds check the vocabulary: what a Thread Group sets, where an assertion applies, which flags run a plan without the GUI. Senior rounds turn to whether the numbers can be trusted: was the load shape realistic, was the injector saturated, did a green sample actually succeed, and what changes when the plan runs on several machines. Start with plan structure and the Thread Group, then data and assertions; execution, results and distribution only make sense once a single-machine plan is correct.
primer
### A plan is a tree, and position is scope Samplers and logic controllers run in the order they appear. Almost everything else — timers, assertions, config elements, pre- and post-processors, listeners — applies by position, to the samplers beneath its parent. Most "why did this timer fire twice" or "why is this check ignored" questions come down to where an element sits, and to the fixed order in which the elements around one sampler take their turn. ### A thread is a user, not a rate The classic Thread Group expresses a closed model: you choose how many virtual users exist, and each one loops through the plan, waiting for every response before sending the next request. Throughput is therefore an outcome of user count, response time and think time together, and it falls when the system slows down. Interviewers probe whether you know which workload model your plan expresses, and which elements let you ask for a rate instead. ### Each user carries its own state Variables are private to a thread; properties are shared by the whole JVM. Realistic traffic needs per-user data — logins from a file, ids pulled out of one response and sent in the next. This **correlation** work is where a recorded script turns into a test that survives a second iteration. ### Green means the request returned, not that it worked Without an assertion, an HTTP sample is judged by its status code alone. An error page served with a 200 counts as a success, and a run full of them reports a healthy system. Checks cost CPU on the injector, and the plan must also decide what a thread does after a failure. ### The load generator is part of the measurement The GUI exists to build and debug plans; real load runs from the command line. A busy injector — a full heap, a listener holding every response, an exhausted CPU — inflates response times and makes the system under test look slower than it is. Spreading load over several engines adds capacity, but every engine runs the whole plan. ### A run leaves rows; the verdict is yours JMeter writes a row per sample and can build a report from those rows, but it does not decide whether the test passed. Percentiles, error rates and the pass rule belong to whoever reads the results — a person or a pipeline step.
- Test plan
- The root of a JMeter tree, saved as an XML .jmx file. It holds thread groups, configuration and test-wide settings, and is the unit you run.
- Thread Group
- The element that creates virtual users: how many threads start, how fast they ramp up, and how long or how many times each one loops.
- Sampler
- An element that sends one request — HTTP, JDBC, JMS and others — and produces a sample result with timings, status and response data.
- Logic controller
- An element that decides which child samplers run and how often: loops, conditions, transactions, once-only blocks and module references.
- Config element
- An element that supplies settings or data to the samplers in its scope, such as defaults, a cookie store, headers or a CSV data feed.
- Timer
- An element that inserts a pause before the samplers in its scope, used for think time or to hold a target throughput.
- Pre- and post-processor
- Elements that run just before or just after a sampler, typically to prepare request data or to extract values from the response.
- Assertion
- An element that inspects a sample result after it returns and marks it failed when the response does not meet a rule.
- Listener
- An element that receives sample results to display, aggregate or write them; most keep results in memory, which matters under load.
- JTL file
- The results file a run writes, one row per sample, usually CSV. Reports, dashboards and pipeline checks are all built from it.
- JMeter variable
- A named value private to one thread, set by extractors, data files or scripts and referenced in later elements as ${name}.
- JMeter property
- A named value shared by every thread in the JVM, often passed in from the command line to parameterise a plan.
- Correlation
- Capturing a dynamic value, such as a session token or order id, from one response and sending it in a later request.
- Injector
- The machine and JVM that generate load. Its CPU, memory and network bound how much load it can produce honestly.
- Closed workload model
- A model where a fixed number of users each wait for a response before acting again, so arrival rate depends on response time.
- JSR223 element
- A scripted sampler, processor, timer, assertion or listener whose logic is written in a scripting language, usually Groovy.
- Backend Listener
- A listener that streams aggregated metrics during the run to an external time-series store for live dashboards.
Follow one iteration. When the run starts, setUp groups run to completion, then every regular Thread Group starts its threads according to its ramp-up. Each thread walks the tree: logic controllers pick the next sampler, the config elements, pre-processors and timers in scope prepare and delay it, the sampler sends its request, and the result then passes through post-processing, checks and recording. Extracted values land in that thread's variables and shape the next request. When every thread has stopped, tearDown groups run. The sections of the hub hang off that loop: - **Load shaping** decides how many threads exist and how pauses and throughput controls pace them. - **Dynamic values** feed the variables that make each request different. - **Sample verdicts** sit right after the sampler and decide the `success` flag on each row. - **Run output** is what listeners write, and the report built from it afterwards. - **Headless execution** and **multi-engine runs** change where the loop runs, not what it does; in distributed mode each engine runs the full plan and streams results back to the controller. - **Custom behaviour** and **protocol coverage** plug new samplers and processors into the same tree. The seams between those sections are usually properties. A plan that reads its knobs from properties can be run unchanged from a laptop, a CI agent or several engines: ```bash # Thread Group fields hold ${__P(users,10)}, ${__P(rampup,30)}, ${__P(duration,300)} jmeter -n -t checkout.jmx -Jusers=200 -Jrampup=120 -Jduration=1800 -l run.jtl -e -o report/ ``` The command sets the load, the plan stays the same file, and the results file feeds both the report and any pass rule a pipeline applies. In a distributed run, remember that 200 here means 200 per engine.
- Plan Composition →
The element families, scoping rules and execution order that every other section takes for granted.
- Load Shaping →
How thread count, ramp-up, timers and throughput controls turn a plan into a load shape.
- Dynamic Values →
Variables, properties, data files and extraction: what makes each user and iteration send different requests.
- Sample Verdicts →
How a sample is judged and what happens after a failure, so green results mean something.
- Headless Execution →
Running without the GUI and keeping the injector from becoming the bottleneck you measure.
- Run Output →
What the results file and HTML dashboard report, and how to read their timings and percentiles.
Adding threads to reach a requests-per-second target: the stock Thread Group sets concurrency, and the rate it achieves depends on response time and pacing.
Trusting a green run with no assertions: an error page served with a 2xx or 3xx status still counts as a successful sample.
Driving load from the GUI, or leaving View Results Tree in the plan during a load run, so the injector itself skews the timings.
Expecting distributed mode to divide the load: every engine runs the whole plan, so thread counts multiply and each engine reads its own copy of the data file.
Gating a build on JMeter's exit code: it reports that the process ran, not that samples passed — count the
successcolumn or apply an explicit rule.Referencing a value in the same sampler whose post-processor extracts it; the request was already sent, so only later samplers see it.
Interpolating
${...}inside a cached JSR223 script instead of readingvars: the compiled script freezes the first substituted value.Reporting average response time as the result; percentiles, the error rate and throughput per label are what a load-test verdict rests on.
Committing a plan that uses third-party plugin elements without making those plugins part of every injector and CI image.
Interviewers expect you to place JMeter among load tools, not only to operate it. Its closest rivals are code-first runners: Gatling, k6 and Locust, where a test is a program in a general-purpose language, reviewed and merged like any other code. JMeter's plans are XML edited through a GUI, which helps people who do not write code and makes review and merging harder. The other recurring trade-off is the concurrency model: JMeter gives each virtual user its own thread, while several code-first tools use lighter-weight or event-driven users, so one injector can hold more of them. JMeter's answers are protocol breadth well beyond HTTP, a mature plugin ecosystem and a built-in distributed mode. Around a run, JMeter is usually paired with a time-series store and dashboards fed by the [Backend Listener](/topics/dev-jmeter-results) for live monitoring, with the CI system that schedules unattended runs, and with server-side monitoring of the system under test, which JMeter does not provide. A defensible choice names the team and the workload; [landscape positioning](/topics/dev-jmeter-pipeline-positioning) covers the comparison in depth.
explore
- Q-34236What does each flag in the JMeter command `jmeter -n -t plan.jmx -l results.jtl` do?level: juniorimportance: must knowfreq 88%
- Q-34285In JMeter's Thread Group, what do the Number of Threads and Ramp-up period fields set?level: juniorimportance: must knowfreq 86%
- Q-34215In JMeter, what is the difference in scope between a variable and a property?level: juniorimportance: must knowfreq 85%
- Plan Composition26 questions
- Component Families15 questions
- Reuse Mechanisms11 questions
- Load Shaping29 questions
- Arrival Sources17 questions
- Pacing Controls12 questions
- Dynamic Values26 questions
- Response Extraction10 questions
- Input and Scope16 questions
- Sample Verdicts22 questions
- Content Checks11 questions
- Failure Consequences11 questions
- Run Output27 questions
- Sample Capture12 questions
- HTML Dashboard15 questions
- Headless Execution27 questions
- Command Line Runs12 questions
- Generator Capacity15 questions
- Multi-Engine Runs20 questions
- Remote Topology10 questions
- Scaling Limits10 questions
- Custom Behaviour23 questions
- Embedded Scripts17 questions
- Packaged Extensions6 questions
- Protocol Coverage30 questions
- Web Requests18 questions
- Non-Web Samplers12 questions
- Pipeline Fit16 questions
- Unattended Runs11 questions
- Landscape Positioning5 questions
questions
246 · 10 sectionsIn an Apache JMeter test plan, what are the element families and what does each one contribute?
basics
~20 sJMeter's Add menu groups elements into families: Threads (Users), Sampler, Logic Controller, Config Element, Timer, Pre Processors, Post Processors, Assertions, Listener, Test Fragment and Non-Test Elements. The family tells you what an element does around a sampler.
In a JMeter test plan, in what order do the elements around a single sampler run?
basics
~10 sConfiguration elements first, then Pre-Processors, then Timers, then the Sampler, then Post-Processors, Assertions and Listeners. The last three are skipped when the sampler returns a null SampleResult.
In a JMeter test plan, what does a Test Fragment element do when the plan runs?
basics
~20 sA Test Fragment holds test elements but never runs on its own. It sits under the Test Plan beside the Thread Groups, and JMeter executes its contents only when a Module Controller or an Include Controller references it.
In a JMeter .jmx file, why does every test element have a hashTree element after it?
basics
~10 sA .jmx writes JMeter's tree as alternating pairs: the element, then a hashTree holding that element's children. Nesting lives in the paired hashTree, so an element with no children still gets an empty one.
In a JMeter test plan, what decides which samplers a timer or an assertion applies to?
basics
~20 sTree position decides. Timers, assertions, listeners, config elements and pre- and post-processors are hierarchical: they apply to every sampler at or below their parent. Attach one under a single sampler and only that sampler is affected.
In JMeter's Uniform Random Timer, what pause do Constant Delay Offset 300 and Random Delay Maximum 700 produce?
basics
~10 sEach pause is 300 ms plus a uniformly drawn value between 0 and 700 ms, so the thread waits somewhere from 300 to 1000 ms before every sampler the timer holds.
In JMeter's Open Model Thread Group, what does the Schedule rate(10/sec) random_arrivals(5 min) run?
basics
~20 sA flat ten arrivals per second for five minutes. The rate step names the arrival rate, random_arrivals spans five minutes, and because no rate follows the span its end rate is taken to equal its start rate.
Which thread groups does a stock Apache JMeter 6 download actually ship?
basics
~10 sFour: Thread Group, setUp Thread Group, tearDown Thread Group and Open Model Thread Group. The Concurrency, Arrivals, Free-Form Arrivals, Ultimate and Stepping groups are third-party, from the jpgc-casutg add-on.
In JMeter's Thread Group, what do the Number of Threads and Ramp-up period fields set?
basics
~20 sNumber of Threads sets how many JMeter threads run the plan concurrently. Ramp-up period sets how many seconds JMeter takes to start all of them. Each thread then walks the whole plan on its own.
In JMeter's Constant Throughput Timer, what does a Target Throughput of 600 ask for?
basics
~20 s600 samples per minute, not per second, so ten a second. The field's unit is per minute, and by default the rate applies to each thread on its own, counting every sampler in the timer's scope.
In JMeter's CSV Data Set Config, what happens if you leave Variable Names empty?
basics
~20 sJMeter reads the file's first line and uses its fields as the variable names. That line is consumed as a header, never handed to a thread as data, and the Delimiter field must match the header's separator.
In JMeter, how do you write a call to a built-in function such as __UUID?
basics
~10 sJMeter function calls take the form ${__functionName(arg1,arg2)}. The double underscore marks a built-in, the parentheses hold comma-separated positional arguments, and a function that takes none may drop them: ${__UUID}.
In JMeter's Regular Expression Extractor, what does a Template value of $1$ refer to?
basics
~20 sTemplate $1$ inserts the text captured by the first parenthesised group of the Regular Expression field. JMeter builds the stored value from the Template, so $0$ means the whole match and $1$ the first group.
In Apache JMeter, how do you capture an order id from a JSON confirmation body for the next request?
basics
~20 sAdd a JSON Extractor as a child of the sampler that returns the confirmation body, give it a variable name and a JSON Path expression, then reference the captured value as ${orderId} in the next request.
In JMeter, what is the difference in scope between a variable and a property?
basics
~10 sA JMeter variable is a per-thread copy that no other thread can read or change. A JMeter property is a single JVM-wide value that every thread in the run shares.
In JMeter, when does a Response Assertion run relative to the sampler it checks?
basics
~10 sStraight after the sampler returns, on the very same JMeter thread. The order inside one sampler cycle is timers, the sample, post-processors, assertions, then listeners. Nothing is queued or handed to a worker pool.
In JMeter's Response Assertion, what do the Contains, Matches, Equals and Substring rules each test?
basics
~10 sContains and Matches read the pattern as a Perl5-style regular expression: Contains needs it found somewhere in the field, Matches needs it to span the whole field. Equals and Substring are plain, case-sensitive text.
In JMeter's Thread Group, what does the 'Action to be taken after a Sampler error' setting do?
basics
~20 sIt picks what a thread does when one of its samplers fails: Continue, Start Next Thread Loop, Stop Thread, Stop Test or Stop Test Now. Continue is the default, and a failed assertion counts as an error.
In JMeter, what makes an HTTP Request sample count as successful when no assertion is attached?
basics
~10 sThe HTTP status code alone decides it. JMeter marks a sample successful for any code from 200 to 399 inclusive, and unsuccessful for 4xx and 5xx. Nothing in the response body is read.
In JMeter, how do you fail a sampler whose 200 response body omits the orderId field?
basics
~10 sAttach an assertion under the sampler. A Response Assertion on Text Response with a Substring or Contains pattern, or a JSON Assertion asserting that the path $.orderId exists, turns the green sample red.
Which JMeter command-line flags produce the HTML dashboard at the end of a non-GUI run?
basics
~10 sTwo flags: -e asks JMeter to build the dashboard once the run ends, and -o names the folder it is written to. Both sit next to -l, which JMeter demands before it accepts -e.
In JMeter's HTML dashboard, what does each column of the Statistics table tell you?
basics
~10 sThe Statistics table gives one row per sample label plus a Total row: Label, #Samples, FAIL, Error %, Average, Min, Max, Median, three percentile columns, Transactions/s, and Received and Sent KB/sec.
Which columns does JMeter write into a CSV results file (JTL) by default?
basics
~10 sJMeter's default CSV JTL carries seventeen columns: timeStamp, elapsed, label, responseCode, responseMessage, threadName, dataType, success, failureMessage, bytes, sentBytes, grpThreads, allThreads, URL, Latency, IdleTime and Connect.
In JMeter, which element streams metrics to InfluxDB or Graphite while a test runs?
basics
~10 sThe Backend Listener. Pick a BackendListenerClient implementation - InfluxdbBackendListenerClient or GraphiteBackendListenerClient - then fill its Parameters table with the target URL or host and port, and metrics leave the injector during the run.
How do you build a JMeter HTML dashboard from last night's results file without re-running the test?
basics
~10 sRun the report generator on its own with -g: jmeter -g last-night.jtl -o dashboard. The flag takes an existing results file, so no plan is loaded and no load is generated.
What does each flag in the JMeter command `jmeter -n -t plan.jmx -l results.jtl` do?
basics
~10 s-n runs JMeter without its GUI, -t names the .jmx test plan to load and run, and -l names the JTL file that every sample result is written to.
Why does Apache JMeter print a banner telling you not to load test in GUI mode?
basics
~20 sJMeter prints it on every GUI launch because the GUI is for creating and debugging a plan, not for driving load. The banner also gives the command line to use instead: jmeter -n -t [jmx file] -l [results file] -e -o [report folder].
In Apache JMeter's bin/jmeter launcher, which environment variable sets the JVM heap, and what is its default?
basics
~10 sHEAP. Apache JMeter's bin/jmeter launcher defaults it to -Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m, so an injector starts with a fixed one-gigabyte heap unless HEAP is exported first, normally from bin/setenv.sh.
Which JMeter listeners keep a copy of every sample, and which one is built for a load run?
basics
~20 sMost JMeter listeners keep every sample they receive, View Results Tree and View Results in Table included. Simple Data Writer keeps none - it writes the row and lets the result go, so load runs use it.
In Apache JMeter, what do the -J and -D command-line flags each define?
basics
~10 sJMeter's -J flag defines a JMeter property inside the running JMeter instance; -D defines a Java system property in the JVM. Both take name=value, may be repeated, and are applied while JMeter starts up.
In JMeter, how do the -r and -R command-line flags differ?
basics
~10 sBoth start a JMeter run on remote server processes instead of locally. -r uses the host list already in the remote_hosts property; -R takes the list inline and overrides it.
In JMeter 6, why does a distributed run refuse to start without rmi_keystore.jks?
basics
~20 sSince JMeter 4.0 the RMI transport runs over SSL by default: server.rmi.ssl.disable is false. The keystore that server.rmi.ssl.keystore.file names, rmi_keystore.jks, is not in the download, so you generate it and copy it to every node.
What does JMeter's bin/jmeter-server script actually start on a load generator?
basics
~10 sIt launches JMeter with -s, which starts a long-lived engine process that registers itself for remote calls and then waits. It holds no test plan until a controller sends one.
A JMeter Thread Group asks for 1,000 threads and the plan runs on six remote engines - how many threads hit the target?
basics
~10 sSix thousand. JMeter never splits a plan across engines: the controller sends the whole plan to each one, so the Thread Group's 1,000 threads start once per server. You do the division, not JMeter.
What does JMeter's mode property select for a distributed run, and what is its default?
basics
~10 sJMeter's mode property names the SampleSender each engine uses to return results to the controller. It is read on the controller only, and defaults to StrippedBatch: batched sends with response bodies removed.
Which JMeter element types come in a JSR223 variant?
basics
~20 sApache JMeter 6.0.0 ships six: JSR223 Sampler, JSR223 PreProcessor, JSR223 PostProcessor, JSR223 Assertion, JSR223 Timer and JSR223 Listener. All six extend one base class, so they share the same configuration fields and one process-wide compiled-script cache; each invocation still gets a fresh ScriptEngine from JMeter's single ScriptEngineManager.
In Apache JMeter, which directory does a third-party plugin JAR go in, and which one takes its dependencies?
basics
~10 sThe plugin JAR itself goes in JMETER_HOME/lib/ext. The utility and dependency JARs it needs go in JMETER_HOME/lib. Only lib/ext is scanned for new JMeter components, and only files ending in .jar are picked up.
In a JMeter JSR223 PostProcessor, which bound object hands a captured value to the next sampler?
basics
~10 sThe vars binding, which is the running thread's JMeterVariables object. Call vars.put("orderId", id) inside the script and any later element in that same thread reads the value as ${orderId}.
In JMeter, why does a BeanShell element re-pay its script cost on every call?
basics
~20 sJMeter caches nothing for a BeanShell element. Every invocation hands the script straight to that element's bsh.Interpreter, calling eval() on the inline Script field or source() on a Script file, so the interpretation cost repeats per sample.
What does a JMeter JSR223 element's 'Cache compiled script if available' checkbox actually do?
basics
~20 sIt lets JMeter compile the inline Script once and reuse the compiled form instead of handing the source to the engine on every execution. It only bites if the engine implements javax.script.Compilable, as Groovy does.
In JMeter's HTTP Request sampler, what does ticking Retrieve All Embedded Resources do?
basics
~20 sJMeter parses the response for referenced images, stylesheets, scripts and frames, then issues an extra GET for every one it finds. The sampler's result becomes a container holding the page plus one sub-sample per asset.
In a JMeter test plan, what does adding an HTTP Cookie Manager change about the requests sent?
basics
~20 sAn HTTP Cookie Manager gives every JMeter thread its own cookie store: it saves the cookies a response sets and replays the matching ones on later requests to that site, so each thread holds a separate session.
In Apache JMeter, what must exist before a JDBC Request sampler can run a query?
basics
~20 sA JDBC Connection Configuration element whose Variable Name for created pool matches the sampler's pool field, plus the vendor's driver jar in JMeter's lib directory. A name mismatch fails the sample with "No pool found named".
How does JMeter's JMS Publisher find the broker it publishes to?
basics
~20 sThrough a JNDI lookup. Either tick Use jndi.properties file, or fill in Initial Context Factory and Provider URL on the sampler itself; Connection Factory and Destination name what is looked up either way. The provider's own client JAR must already sit in JMeter's lib directory.
Before JMeter's HTTP(S) Test Script Recorder will start, what must the test plan already contain?
basics
~20 sA Thread Group with a Recording Controller under it. The recorder's Target Controller defaults to Use Recording Controller, and pressing Start with no Recording Controller anywhere in the tree raises an error instead of opening the proxy.
A JMeter non-GUI run where every sample failed still exited 0. What does JMeter's exit code report?
basics
~20 sJMeter's exit code reports whether the process itself completed, not whether the test passed. A non-GUI run returns 0 at a 100 percent error rate; only a start-up throwable or a shutdown that leaves threads running returns 1.
What does Apache JMeter give a team out of the box that a code-first load runner does not?
basics
~10 sApache JMeter 6.0.0 ships a free Apache-2.0 GUI plan editor, samplers for protocols well beyond HTTP, a built-in controller-and-engine distributed mode, an HTML report generator, and a large third-party plugin ecosystem.
A nightly job runs jmeter -n -t plan.jmx -l results.jtl -e -o report and it fails on the second run. Why?
basics
~20 sLast night's report directory is still there and is not empty, so JMeter refuses to write into it and aborts before the plan is even loaded. Adding -f deletes the old report folder and results file first.
Which column in a JMeter JTL file must a pipeline's pass rule count?
basics
~20 sThe success column. JMeter writes the literal true or false there for every sample, and a false row is the only dependable marker of a failed sample; responseCode can still read 200 on a failed one.
Why is a JMeter .jmx plan harder to review and merge than a scripted load test?
basics
~20 sA .jmx plan is XML that JMeter's GUI writes and rewrites in full on every save, so a one-field edit arrives as machine-generated markup, and two authors' saves collide across the whole document rather than on one line.