Hi all, I am the author of PR #6855, which adds opt-in support for running JMeter user threads on virtual threads. In his review of that PR, milamberspace suggested coordinating here first, because three separate efforts are aiming at the same goal and Vladimir's question on how they relate is still open. This mail is my attempt to start that discussion. I am copying the authors of the other two PRs, olka (#6685) and milad-fa (#6506), and I would welcome their corrections to anything I describe about their work.
For reference, the three efforts: * #6855 (mine): an opt-in property on the existing ThreadGroup. * #6685 (olka): virtual threads always on, with a Java 21 build migration. * #6506 (milad-fa): a new VirtualThreadGroup element. * The parent discussion is issue #6411. What #6855 does, and what I think is sound in it: It adds one property, jmeterthread.use_virtual_threads, default false, and routes the two thread creation sites in ThreadGroup through a single new factory class. The whole change is four files. The build stays on Java 17; the Java 21 API is reached reflectively, resolved once, and if virtual threads are not available the factory falls back to a platform thread with a warning. Because the existing ThreadGroup lifecycle is reused whole, ThreadLocal semantics, thread tracking, and stop behaviour are unchanged, and a unit test covers them. Above all, the default behaviour of JMeter does not change for anyone: a user gets virtual threads only by choosing them, which seems to me the right adoption path for a load testing tool, where a silent change in thread behaviour could alter measured results. Where #6855 is weak, stated plainly: * Pinning is documented, not fixed. On Java 21, synchronized code in the engine and in samplers still pins carrier threads, and the PR only warns about this. * The benchmark is a sleeping sampler at 2,000 users, with no percentiles. It is not the HTTP benchmark, at thousands of users with p90 and p99 and generator CPU, that milamberspace asked for. * OpenModelThreadGroup is not covered by the property. * Thread dumps no longer show user threads, and the jcmd workaround is not yet documented. * The properties reference and changes.xml entries are still missing. What the other two PRs do better, and what I would like us to incorporate: >From #6685, the substantial item is the thread pinning solution: olka converted synchronized to ReentrantLock in StandardJMeterEngine, ThreadGroup, JMeterContextService, TestCompiler and AbstractThreadGroup. That is the proper fix for the pinning weakness above, and I propose we adapt it into this line of work, as its own separate change with olka credited, rather than leaving pinning as a documented caveat. #6685 also benchmarked over real HTTP in an A/B comparison against master, which is the method I intend to follow for the benchmark on #6855, and it reasoned explicitly about keeping the engine executor on platform threads, since virtual threads are daemon and would let a non-GUI JVM exit early. >From #6506, the idea worth keeping is per-element choice: letting a test plan choose virtual threads for one thread group and not another, with a GUI presence rather than only a property. I would not adopt its implementation, which duplicates the ThreadGroup lifecycle in a new class and would need every future fix twice. Instead, per-group choice could be layered later on top of the same factory #6855 introduces, if the project wants it. Questions I would like the list to settle: 1. Is the opt-in property on the existing ThreadGroup, #6855, the agreed base to build on? 2. Should the ReentrantLock conversions from #6685 be brought in as a separate change, and if so, before or after the opt-in itself? 3. Is a per-group element wanted now, later on top of the shared factory, or not at all? 4. Is the benchmark bar HTTP at thousands of users, reporting p90 and p99 and generator CPU, as milamberspace described? 5. JEP 491 in JDK 24 removes pinning for synchronized code, so the ReentrantLock conversions only serve users running on JDK 21 to 23 window. Given the project's Java baseline roadmap, are those conversions still wanted, and does that change the sequencing? Once the direction is agreed, I will work through the review list on #6855: the OpenModelThreadGroup question, the thread dump documentation, the measurement bias warning in the property documentation, the JMeterSerialTest fix, and the documentation and changelog entries. Thank you to milamberspace for the careful review, and to olka and milad-fa for their work on this problem. I am happy to adjust #6855 in whatever direction the project prefers. Best regards, Yavdhesh Sanchihar
