#6720·jmeter

Parent Controller Path Caching Optimization

Author: rajat315315Created Jul 8, 2026Updated Jul 16, 2026
Labelsenhancementto-triage

Use case

Description

In JMeter, when a sampler fails with onErrorStartNextLoop enabled, or when loop logical actions (such as Break/Continue) are triggered, JMeter is forced to find the parent controller hierarchy from the current sampler up to the thread group root.

Currently, this is done by executing testTree.traverse() with a FindTestElementsUpToRootTraverser every time the loop action is triggered. For large test plans with deep nesting structures, this full DFS tree walk is highly redundant since the test tree's hierarchical structure does not change during the execution run. This leads to severe performance degradation and high CPU usage under high-failure loads.

Possible solution

Proposed Improvement

Add a thread-local parent controller path cache (Map<Sampler, List<Controller>>) inside JMeterThread. When resolving parent controllers:

  1. Query the map to see if the sampler's parent controllers list has already been resolved.
  2. If it is a cache miss, perform the testTree.traverse() once and store the result.
  3. If it is a cache hit, return a lightweight mock traverser containing the cached controllers list directly, completely skipping the expensive DFS tree traversal.

Possible workarounds

No response

JMeter Version

6.0.0-SNAPSHOT

Java Version

No response

OS Version

No response