Currently JMeter starts all threads at startup and makes them pause to respect the ramp. This feature is interesting when you want to use short lived thread and start a lot of them (thousands). Taking into account Kirk Pepperdine requirement on users list: http://mail-archives.apache.org/mod_mbox/jmeter-user/201206.mbox/%3CDB7650C0-5BA5-4C1E-A094-F8E5D35BA189%40gmail.com%3E
I investigated this one, my draft implementation idea is the following: - Make AbstractThreadGroup control the life of the JMeterThread threads - So AbstractThreadGroup would have: 1) a start method that would trigger a Thread. This thread will launch JMeterThreads and control their life. 2) A stop method to stop/interrupt them 3) isCreatingThreadsOnDemand which would return true for new behaviour If isCreatingThreadsOnDemand returns false, StandardJMeterEngine would create Threads as today. If true, implementation of ThreadGroup would create threads as part of its internal behaviour. This way I think we don't break existing plugins that extend AbstractThreadGroup. But the bad point about it is that thread creation algorithm will be in Thread Group unless we move it in AbstractThreadGroup and call it or not, which might be better as we need to keep control on this part to ensure right shutdown, stop....
Created attachment 29054 [details] Proposed Patch Hello, I implemented this feature. Hope you can have a look at it soon. Regards Philippe M.
Created attachment 29055 [details] Test Plan
Hello, Feature is implemented this way: - Moved Thread control into AbstractThreadGroup - Default start method of AbstractThreadGroup creates threads at start of test - New AbstractThreadGroup called OnDemandThreadGroup creates Threads when needed - OnDemandThreadGroupGui just changes class of ThreadGroup
Date: Fri Jul 13 21:49:30 2012 New Revision: 1361410 URL: http://svn.apache.org/viewvc?rev=1361410&view=rev Log: Bug 53418 - New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup Bugzilla Id: 53418 Added: jmeter/trunk/src/core/org/apache/jmeter/threads/OnDemandThreadGroup.java (with props) jmeter/trunk/src/core/org/apache/jmeter/threads/gui/OnDemandThreadGroupGui.java (with props) Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java jmeter/trunk/xdocs/changes.xml Date: Fri Jul 13 21:50:08 2012 New Revision: 1361411 URL: http://svn.apache.org/viewvc?rev=1361411&view=rev Log: Bug 53418 - New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup Documentation update Bugzilla Id: 53418 Added: jmeter/trunk/docs/images/screenshots/ondemandthreadgroup.png (with props) jmeter/trunk/xdocs/images/screenshots/ondemandthreadgroup.png (with props) Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
Date: Fri Jul 13 21:58:42 2012 New Revision: 1361414 URL: http://svn.apache.org/viewvc?rev=1361414&view=rev Log: Bug 53418 - New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup Fix saveservice.properties Bugzilla Id: 53418 Modified: jmeter/trunk/bin/saveservice.properties
Date: Fri Jul 13 22:04:06 2012 New Revision: 1361415 URL: http://svn.apache.org/viewvc?rev=1361415&view=rev Log: Bug 53418 - New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup Fix SaveService fileVersion and version Bugzilla Id: 53418 Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
Reworked the code: URL: http://svn.apache.org/viewvc?rev=1372462&view=rev Log: Merge OnDemandThreadGroup into ThreadGroup Bugzilla Id: 53418 Removed: jmeter/trunk/src/core/org/apache/jmeter/threads/OnDemandThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/gui/OnDemandThreadGroupGui.java Modified: jmeter/trunk/bin/saveservice.properties jmeter/trunk/docs/images/screenshots/threadgroup.png jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java jmeter/trunk/xdocs/images/screenshots/threadgroup.png jmeter/trunk/xdocs/usermanual/component_reference.xml URL: http://svn.apache.org/viewvc?rev=1372467&view=rev Log: No longer need these Removed: jmeter/trunk/docs/images/screenshots/ondemandthreadgroup.png jmeter/trunk/xdocs/images/screenshots/ondemandthreadgroup.png URL: http://svn.apache.org/viewvc?rev=1372481&view=rev Log: Merge OnDemandThreadGroup into ThreadGroup: Don't display delayed start for setUp/tearDown thread groups Rename onDemand as delayed_start Make the property optional in JMC files Bugzilla Id: 53418 Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/gui/PostThreadGroupGui.java jmeter/trunk/src/core/org/apache/jmeter/threads/gui/SetupThreadGroupGui.java jmeter/trunk/src/core/org/apache/jmeter/threads/gui/ThreadGroupGui.java URL: http://svn.apache.org/viewvc?rev=1372484&view=rev Log: delayedStartup needs to be constant Bugzilla Id: 53418 Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
URL: http://svn.apache.org/viewvc?rev=1372655&view=rev Log: Add delayed_start French translation Bugzilla Id: 53418 Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc?rev=1373042&view=rev Log: StandardJMeterEngine is now responsible for starting thread groups, which in turn are responsible for their threads. All the thread creation and scheduling is now handled by the thread group. This allows the JMeterThread instances to be created only when needed by the delayed start method. Memory should now be only limited by the number of concurrent threads. Bugzilla Id: 53418 Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java jmeter/trunk/src/core/org/apache/jmeter/threads/AbstractThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java
Bug name was: - New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup
*** Bug 47886 has been marked as a duplicate of this bug. ***
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2844