Bug 53418 - New Option "Delay thread creation until needed" that will create and start threads when needed instead of creating them on Test startup
New Option "Delay thread creation until needed" that will create and start th...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.7
All All
: P2 enhancement with 1 vote (vote)
: ---
Assigned To: JMeter issues mailing list
:
: 47886 (view as bug list)
Depends on:
Blocks: 53501
  Show dependency tree
 
Reported: 2012-06-14 21:13 UTC by Philippe Mouawad
Modified: 2012-09-28 14:05 UTC (History)
2 users (show)



Attachments
Proposed Patch (28.06 KB, patch)
2012-07-12 21:53 UTC, Philippe Mouawad
Details | Diff
Test Plan (12.59 KB, application/xml)
2012-07-12 21:53 UTC, Philippe Mouawad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2012-06-14 21:13:02 UTC
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
Comment 1 Philippe Mouawad 2012-07-08 13:59:27 UTC
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....
Comment 2 Philippe Mouawad 2012-07-12 21:53:39 UTC
Created attachment 29054 [details]
Proposed Patch

Hello,
I implemented this feature.
Hope you can have a look at it soon.

Regards
Philippe M.
Comment 3 Philippe Mouawad 2012-07-12 21:53:56 UTC
Created attachment 29055 [details]
Test Plan
Comment 4 Philippe Mouawad 2012-07-12 21:55:47 UTC
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
Comment 5 Philippe Mouawad 2012-07-13 21:50:47 UTC
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
Comment 6 Philippe Mouawad 2012-07-13 21:59:20 UTC
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
Comment 7 Philippe Mouawad 2012-07-13 22:04:49 UTC
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
Comment 8 Sebb 2012-08-13 16:09:58 UTC
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
Comment 9 Milamber 2012-08-13 22:24:59 UTC
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
Comment 10 Sebb 2012-08-14 19:35:10 UTC
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
Comment 11 Philippe Mouawad 2012-08-20 19:57:14 UTC
Bug name was:
- New OnDemandThreadGroup that creates threads when needed instead of creating them on Test startup
Comment 12 Sebb 2012-09-28 14:05:41 UTC
*** Bug 47886 has been marked as a duplicate of this bug. ***