skip to content

Web Requests

The web side of the tool: one sampler with a great many switches, the manager elements that hold cookies, cache and headers per thread, and the proxy that records a browser session.

on this pageshow

explore

questions

18

In JMeter's HTTP Request sampler, what does ticking Retrieve All Embedded Resources do?

level: juniorimportance: must knowfreq 74%

answer

  1. A checkbox that multiplies your requests
  2. Advanced tab, embedded resources panel
  3. Parser picked by response media type
  4. Two regex fields narrow the list

basics

~20 s

JMeter 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.

solid answer

~50 s

The checkbox lives in the **Embedded Resources from HTML Files** panel on the HTTP Request's Advanced tab and is stored as `HTTPSampler.image_parser`. After the main response arrives, JMeter picks a parser by media type — `HTTPResponse.parsers` ships as `htmlParser wmlParser cssParser` — extracts every referenced URL and sends a plain `GET` for each one. Parsing happens only when the main sample succeeded *and* its data type is text, so a binary response never fans out — and a JSON response, though JMeter does mark it text, fans out nothing either, because no parser is registered for its media type. The extra requests become sub-samples of a container result whose byte count is the sum of them all and whose elapsed time runs to the last one. **URLs must match** and **URLs must not match** are regular expressions applied to the extracted URLs before any of them is fetched.

code

xml · 10 lines
xml
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home Page">
  <stringProp name="HTTPSampler.domain">shop.example.invalid</stringProp>
  <stringProp name="HTTPSampler.path">/</stringProp>
  <stringProp name="HTTPSampler.method">GET</stringProp>
  <boolProp name="HTTPSampler.image_parser">true</boolProp>
  <boolProp name="HTTPSampler.concurrentDwn">true</boolProp>
  <stringProp name="HTTPSampler.concurrentPool">6</stringProp>
  <stringProp name="HTTPSampler.embedded_url_re">https://shop\.example\.invalid/.*</stringProp>
  <stringProp name="HTTPSampler.embedded_url_exclude_re">.*\.(?i:svg|png)</stringProp>
</HTTPSamplerProxy>

go deeper

for a junior

Be able to point at the checkbox and say what it costs: one sampler stops being one request. Know that the extra calls are GETs and that they appear underneath the sampler, not beside it.

for a middle

Explain the gating conditions — successful sample, text data type, a parser registered for that media type — and name the two regex fields that filter the extracted URLs.

for a senior

Talk about what the container sample's timings and byte counts then mean, and about the failure semantics: one bad asset fails the whole container unless you flip httpsampler.ignore_failed_embedded_resources.

for a principal

Own the plan-wide call: whether every page sampler carries this flag, whether the allow and deny regexes are set once on HTTP Request Defaults, and how you keep the resulting sample counts comparable between runs.

JMeter's **HTTP Request** sampler normally sends exactly one request. Ticking **Retrieve All Embedded Resources**, in the *Embedded Resources from HTML Files* panel on the sampler's Advanced tab, turns it into a small crawler: once the main response is in, JMeter reads the body, pulls out every URL a browser would have had to fetch to render the page, and requests each of those too. In the saved `.jmx` the flag is the boolean property `HTTPSampler.image_parser`. ## Three conditions before anything is parsed JMeter only looks at the body when all of these hold: 1. the flag is on for that sampler (or inherited from an **HTTP Request Defaults** element); 2. the main sample is **successful** — a page that failed is never scanned; 3. the result's data type is **text**, which JMeter derives from the response's `Content-Type`. Then it looks up a parser for the response's media type. The mapping shipped in `bin/jmeter.properties` is: ```properties HTTPResponse.parsers=htmlParser wmlParser cssParser htmlParser.className=org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser htmlParser.types=text/html application/xhtml+xml application/xml text/xml cssParser.types=text/css wmlParser.types=text/vnd.wap.wml ``` If the media type is in none of those lists there is no parser and nothing extra is fetched, box ticked or not. That is why a JSON API response never fans out, however many URLs its payload contains. `htmlParser.className` can be pointed at the JTidy, Jsoup or older regexp parsers instead of the default Lagarto-based one. ## How the extra requests are issued Every extracted URL is requested with **GET**, whatever method the parent sampler used, and each response is attached to the parent as a sub-sample. Downloads are **serial by default**: the same JMeter thread that ran the page runs each asset one after another. Ticking **Parallel downloads. Number:** hands them to a shared executor instead; the number field defaults to `6` (`HTTPSampler.concurrentPool`). Nesting is followed as well — a frame or iframe whose own response is HTML gets parsed in turn — but only to the depth in `httpsampler.max_frame_depth`, default `5`. Past that JMeter attaches an error sub-sample reading *Maximum frame/iframe nesting depth exceeded*. ## Narrowing what gets fetched Two fields on the same panel take regular expressions and are applied to each extracted URL before it is requested: - **URLs must match** — an allow list. Left empty, everything is allowed. - **URLs must not match** — a deny list. Left empty, nothing is denied. Worth knowing: a syntactically broken pattern is *not* an error. JMeter logs `Ignoring embedded URL allow string: …` and falls back to the field's default answer, so a broken allow expression quietly downloads everything and a broken deny expression quietly excludes nothing. ## What lands in your results Instead of one result you get a **container** sample carrying the page result plus one sub-sample per asset. The container's byte count is the sum of all of them and its elapsed time runs from the page request's start to the last asset's end. With the default `jmeter.save.saveservice.subresults=true`, each sub-sample is written to the JTL as its own row, so a page with twenty assets contributes twenty-two rows, not one. By default a failed asset drags the container down with it: JMeter sets the container unsuccessful and rewrites its response message to `Embedded resource download error: …`. Setting `httpsampler.ignore_failed_embedded_resources=true` keeps the container green and leaves the failure visible only on the child. ## Traps worth naming in an interview | Belief | What actually happens | |---|---| | "The assets use the sampler's method" | Every embedded request is a `GET`. | | "A failed page still lists its assets" | Parsing is skipped entirely when the sample failed. | | "Assets are downloaded in parallel" | Serial unless **Parallel downloads** is ticked. | | "One tick, one sample" | One tick, one container plus N children. | Two related switches sit beside it and are frequently confused with it: **Save response as MD5 hash** stores a 32-character hash instead of the body, and `httpsampler.embedded_resources_use_md5=true` does the same for embedded responses only, keeping the size and hash rather than the bytes. Neither changes which requests are sent — only what is kept.

  • Which response content types does JMeter actually scan for embedded resources?
    Only those listed against a configured parser. The shipped `HTTPResponse.parsers` value is `htmlParser wmlParser cssParser`, covering `text/html`, `application/xhtml+xml`, `application/xml`, `text/xml`, `text/css` and `text/vnd.wap.wml`. Anything else — JSON, images, PDFs — has no parser, so no embedded requests are generated no matter what the body contains.
  • What stops JMeter looping forever on a page whose frames reference each other?
    The `httpsampler.max_frame_depth` property, default `5`. JMeter parses nested HTML documents recursively and increments the depth each time; past the limit it stops and attaches an error sub-sample saying the maximum frame/iframe nesting depth was exceeded, rather than continuing to descend.

saying these in an interview costs you the question

  • Says the embedded requests reuse the parent sampler's method
  • Believes a JSON response is also scanned for URLs
  • Assumes the assets are fetched in parallel by default
  • Thinks each asset shows up as its own top-level sampler
  • Expects a failed page to still fetch its assets
open as a page

Before JMeter's HTTP(S) Test Script Recorder will start, what must the test plan already contain?

level: juniorimportance: must knowfreq 68%

basics

~20 s

A 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.

open as a page

In JMeter's HTTP Request, how do Follow Redirects and Redirect Automatically differ?

level: middleimportance: must knowfreq 66%

basics

~20 s

Follow Redirects makes JMeter chase the Location itself and record every hop as a sub-sample. Redirect Automatically hands the chase to the HTTP client, so the hops never become samples. The two checkboxes are mutually exclusive.

open as a page

In JMeter's HTTP(S) Test Script Recorder, how do the URL Patterns to Include and Exclude decide what is kept?

level: middleimportance: must knowfreq 62%

basics

~20 s

Both fields hold regular expressions matched against the whole host:port/path?query string. With any Include pattern present the URL must match one, and matching any Exclude pattern drops it. Filtering decides what is recorded, not what the browser receives.

open as a page

After recording a checkout journey with JMeter's recorder, what does the plan still need before it can replay?

level: seniorimportance: must knowfreq 64%

basics

~20 s

A recording is a draft. JMeter strips the Cookie header and adds no Cookie Manager, leaves every identifier the browser sent as a literal, and stores each asset as its own sampler. State handling, correlation and pruning are still yours.

open as a page

In JMeter's HTTP Request, when is an uploaded file sent as the whole body rather than a multipart part?

level: middleimportance: should knowfreq 42%

basics

~20 s

JMeter does that when the Files Upload tab holds one row with a blank Parameter Name and the Parameters tab is empty. The file's bytes become the body and the row's MIME Type becomes Content-Type.

open as a page

What do JMeter samplers inherit from an HTTP Request Defaults element, and what wins?

level: middleimportance: should knowfreq 58%

basics

~10 s

Only the fields a sampler leaves empty. HTTP Request Defaults supplies server, port, protocol, timeouts, implementation, proxy and the embedded-resource settings, and a value already present on the sampler always wins.

open as a page

Which JMeter property stops the HTTP Authorization Manager from sending BASIC credentials unchallenged?

level: middleimportance: should knowfreq 40%

basics

~10 s

Set httpclient4.auth.preemptive=false in user.properties. The HttpClient4 implementation defaults it to true, so the Authorization header rides on the very first request; with it false, credentials go only after the server sends a challenge.

open as a page

What do the five Grouping options of JMeter's HTTP(S) Test Script Recorder do?

level: middleimportance: should knowfreq 48%

basics

~20 s

Grouping decides how requests that arrived close together are laid out: not grouped, separated by a divider controller, wrapped in a Simple Controller, wrapped in a Transaction Controller, or reduced to the first sampler of each group.

open as a page

A JMeter page sampler retrieving twenty embedded assets reports 4-second samples. What is it timing?

level: seniorimportance: should knowfreq 50%

basics

~20 s

The container sample. It starts when the page request started and ends when the last asset finished, so it covers all twenty-one requests. Bytes are summed as well; only Latency still belongs to the page alone.

open as a page

In a JMeter plan with an HTTP Cache Manager, why does the second iteration log fewer samples?

level: seniorimportance: should knowfreq 52%

basics

~10 s

JMeter's HTTP Cache Manager serves a still-fresh GET out of the thread's own cache without touching the network, and its default cached-resource mode, RETURN_NO_SAMPLE, records no result at all for that hit.

open as a page

In a JMeter run against a load-balanced hostname, why does every thread hit the same backend IP?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Without a DNS Cache Manager, JMeter resolves the hostname through the JVM's own DNS cache, so every thread reuses the first address that came back. Adding the element gives each thread a private resolution cache instead.

open as a page

Your JMeter recording of an HTTPS journey fails with unknown_ca in the browser. What do you do?

level: seniorimportance: should knowfreq 55%

basics

~20 s

The browser has not been given JMeter's generated root CA. Install ApacheJMeterTemporaryRootCA.crt, which the recorder exports into its launch directory the first time it starts, as a trusted authority — and reinstall it once the seven-day validity expires.

open as a page

How would you decide which browser-like state a JMeter plan keeps between thread iterations?

level: principalimportance: should knowfreq 33%

basics

~20 s

JMeter has no single reset: the Cookie, Cache, DNS Cache and Authorization Managers each carry their own per-iteration clearing option. Name the population you are simulating, then set all four deliberately in a plan template.

open as a page

Your team re-records its JMeter plans from the browser each release. How would you decide what stays recorded?

level: principalimportance: should knowfreq 38%

basics

~10 s

Treat the recorder as a discovery tool, not a source of truth. Let it produce the request sequence and headers, then keep filtering, naming, state and correlation in hand-maintained parts a re-record cannot overwrite.

open as a page

In JMeter, how do you make the HTTP Cookie Manager expose received cookies as thread variables?

level: middleimportance: nice to knowfreq 28%

basics

~10 s

Set CookieManager.save.cookies=true in bin/user.properties before JMeter starts. Every cookie the manager stores is then written to a thread variable carrying the COOKIE_ prefix, so a cookie named TEST is read as ${COOKIE_TEST}.

open as a page

In JMeter's HTTP Request, what does the Parallel downloads number actually limit?

level: seniorimportance: nice to knowfreq 28%

basics

~20 s

It limits how many of that one sampler's embedded-resource requests are in flight at once, per execution. It does not limit the shared downloader thread pool, which has no maximum and grows with the number of JMeter threads.

open as a page