Skip to content

Parent Controller Path Caching Optimization #6720

Description

@rajat315315

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions