You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "rajat315315 (via GitHub)" <gi...@apache.org> on 2026/07/08 08:39:53 UTC
[I] Parent Controller Path Caching Optimization [jmeter]
rajat315315 opened a new issue, #6720:
URL: https://github.com/apache/jmeter/issues/6720
### 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_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "milamberspace (via GitHub)" <gi...@apache.org>.
milamberspace commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4995823481
@rajat315315 — heads up: the review of your PR #6721 requested some changes (see the summary above and the inline comments on the PR). The main blocker is the cache key semantics; happy to help once you've had a chance to look. Thanks for the contribution!
<sub>Message drafted by an AI-assisted tool (Apache Magpie), confirmed by a maintainer.</sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4994806350
Can you share benchmark/profiling results to justify the change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "rajat315315 (via GitHub)" <gi...@apache.org>.
rajat315315 commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4994977858
I have pasted the results in the Pull Request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "cschanhniem (via GitHub)" <gi...@apache.org>.
cschanhniem commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4917513579
Parent controller path caching optimization is a solid performance improvement. For large testing frameworks, [AGENTOWNERS](https://github.com/agent-owners/agentowners) can define governance around which agents may propose changes to performance-critical code paths in the engine.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "milamberspace (via GitHub)" <gi...@apache.org>.
milamberspace commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4995816172
### Review summary for the proposed optimization
The implementation in #6721 has been reviewed — disposition: **changes requested** ([review](https://github.com/apache/jmeter/pull/6721#pullrequestreview-4717026454)). The caching idea is sound (a sampler's path to root is static during thread execution), but the current implementation has a **blocking correctness issue** plus a testing gap:
1. **Cache key semantics (blocking).** The cache is a `HashMap<Sampler, List<Controller>>`, so it keys on `equals`/`hashCode` — which `AbstractTestElement` defines **by value** (`propMap`). The original tree walk instead identifies the node by **reference identity** (`node == nodeToFind` in `FindTestElementsUpToRootTraverser`). Two distinct-but-equal samplers (e.g. copy-pasted requests) would collide and receive the wrong parent-controller path on error; additionally, a sampler's properties mutate at runtime, making it an unstable hash key. Suggested fix: `IdentityHashMap`, which restores the original identity semantics.
2. **No regression test.** The change alters behaviour on a correctness-sensitive path (loop control on sample error), so a cache-correctness regression would be silent. A test exercising the cache-hit branch — ideally with two equal-but-distinct samplers — is needed.
The performance motivation itself is not in question; only the correctness of the caching mechanism. Full details are in the inline review comments on #6721.
<sub>This summary was drafted by an AI-assisted tool (Apache Magpie) and may contain mistakes; an Apache JMeter maintainer has reviewed and confirmed it.</sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Parent Controller Path Caching Optimization [jmeter]
Posted by "rajat315315 (via GitHub)" <gi...@apache.org>.
rajat315315 commented on issue #6720:
URL: https://github.com/apache/jmeter/issues/6720#issuecomment-4994596815
@vlsi @FSchumacher @dcoomber @milamberspace
Any possibility of a review?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org