Author: pmouawad Date: Wed Sep 5 20:17:14 2018 New Revision: 1840157 URL: http://svn.apache.org/viewvc?rev=1840157&view=rev Log: Bug 62684 - Distributed Testing : Add automatically to thread name a prefix to identify engine Bugzilla Id: 62684
Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/generating-dashboard.xml Modified: jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java?rev=1840157&r1=1840156&r2=1840157&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/engine/RemoteJMeterEngineImpl.java Wed Sep 5 20:17:14 2018 @@ -124,10 +124,11 @@ public final class RemoteJMeterEngineImp * * @param testTree * the feature to be added to the ThreadGroup attribute + * @param host Host and Port */ @Override - public void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws RemoteException { - log.info("Creating JMeter engine on host {} base '{}'", host, jmxBase); + public void rconfigure(HashTree testTree, String hostAndPort, File jmxBase, String scriptName) throws RemoteException { + log.info("Creating JMeter engine on host {} base '{}'", hostAndPort, jmxBase); try { if (log.isInfoEnabled()) { log.info("Remote client host: {}", getClientHost()); @@ -141,7 +142,8 @@ public final class RemoteJMeterEngineImp throw new IllegalStateException("Engine is busy - please try later"); } ownerThread = Thread.currentThread(); - backingEngine = new StandardJMeterEngine(host); + JMeterUtils.setProperty(JMeterUtils.THREAD_GROUP_DISTRIBUTED_PREFIX_PROPERTY_NAME, hostAndPort); + backingEngine = new StandardJMeterEngine(hostAndPort); backingEngine.configure(testTree); // sets active = true } FileServer.getFileServer().setScriptName(scriptName); Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java?rev=1840157&r1=1840156&r2=1840157&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/threads/ThreadGroup.java Wed Sep 5 20:17:14 2018 @@ -297,7 +297,9 @@ public class ThreadGroup extends Abstrac jmeterThread.setThreadNum(threadNumber); jmeterThread.setThreadGroup(this); jmeterThread.setInitialContext(context); - final String threadName = groupName + " " + groupNumber + "-" + (threadNumber + 1); + String distributedPrefix = + JMeterUtils.getPropDefault(JMeterUtils.THREAD_GROUP_DISTRIBUTED_PREFIX_PROPERTY_NAME, ""); + final String threadName = distributedPrefix + (distributedPrefix.isEmpty() ? "":"-") +groupName + " " + groupNumber + "-" + (threadNumber + 1); jmeterThread.setThreadName(threadName); jmeterThread.setEngine(engine); jmeterThread.setOnErrorStopTest(onErrorStopTest); Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1840157&r1=1840156&r2=1840157&view=diff ============================================================================== --- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original) +++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Wed Sep 5 20:17:14 2018 @@ -80,7 +80,10 @@ import com.thoughtworks.xstream.security */ public class JMeterUtils implements UnitTestManager { private static final Logger log = LoggerFactory.getLogger(JMeterUtils.class); + private static final String JMETER_VARS_PREFIX = "__jm__"; + public static final String THREAD_GROUP_DISTRIBUTED_PREFIX_PROPERTY_NAME = "__jm.D_TG"; + // Note: cannot use a static variable here, because that would be processed before the JMeter properties // have been defined (Bug 52783) private static class LazyPatternCacheHolder { Modified: jmeter/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1840157&r1=1840156&r2=1840157&view=diff ============================================================================== --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) +++ jmeter/trunk/xdocs/changes.xml [utf-8] Wed Sep 5 20:17:14 2018 @@ -149,7 +149,7 @@ this behaviour, set <code>httpclient.res <h3>General</h3> <ul> - <li><bug>62128</bug>Try to guess <code>JMETER_HOME</code> correctly, when <code>jmeter.bat</code> is called from a batch file in another directory. Contributed by logox01 (logox01 at gmx.at)</li> + <li><bug>62684</bug>Distributed Testing : Add automatically to thread name a prefix to identify engine</li> <li><bug>62155</bug>Search Feature: Make Search text field get focus</li> <li><bug>62156</bug>Search Feature : Distinguish between node that matches search and node that contains a child that matches search</li> <li><bug>62234</bug>Search/Replace Feature : Enhance UX and add Replace/Next/Previous/Replace & Find features. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li> @@ -158,13 +158,14 @@ this behaviour, set <code>httpclient.res <li><bug>61635</bug>Add a menu to restart JMeter</li> <li><bug>62470</bug>CSV Output : Enable logging of sub results when <code>jmeter.save.saveservice.subresults=true</code>. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li> <li><bug>62473</bug>Setting "<code>saveservice_properties</code>" has counter intuitive behaviour</li> + <li><bug>62354</bug>Correct calculation and usage of units for second per user (reported by jffagot05 at gmail.com)</li> + <li><bug>62128</bug>Try to guess <code>JMETER_HOME</code> correctly, when <code>jmeter.bat</code> is called from a batch file in another directory. Contributed by logox01 (logox01 at gmx.at)</li> + <li><pr>386</pr>Add parameter support for RMI keystore creation scripts. Contributed by Logan Mauzaize (t524467 at airfrance.fr)</li> <li><bug>62065</bug>Use Maven artifact for JAF Module instead of embedded module</li> - <li><pr>379</pr> Improve chinese translations. Contributed by XmeterNet</li> <li><bug>61714</bug>Update Real-time results documentation</li> - <li><bug>62354</bug>Correct calculation and usage of units for second per user (reported by jffagot05 at gmail.com)</li> <li><pr>382</pr>Correct typo in documentation. Reported by Perze Ababa (perze.ababa at gmail.com>)</li> - <li><pr>386</pr>Add parameter support for RMI keystore creation scripts. Contributed by Logan Mauzaize (t524467 at airfrance.fr)</li> <li><pr>392</pr>Correct typo in documentation. Reported by Aaron Levin</li> + <li><pr>379</pr> Improve chinese translations. Contributed by XmeterNet</li> </ul> <ch_section>Non-functional changes</ch_section> Modified: jmeter/trunk/xdocs/usermanual/generating-dashboard.xml URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/generating-dashboard.xml?rev=1840157&r1=1840156&r2=1840157&view=diff ============================================================================== --- jmeter/trunk/xdocs/usermanual/generating-dashboard.xml (original) +++ jmeter/trunk/xdocs/usermanual/generating-dashboard.xml Wed Sep 5 20:17:14 2018 @@ -117,16 +117,6 @@ jmeter.save.saveservice.timestamp_format </ul> </p> </subsection> - <subsection name="§-num;.2.1.4 Distributed Testing configuration" anchor="distributed_requirements"> - <p> - If your are using JMeter distributed mode with multiple jmeter-server instances, ensure you add in your Thread Groups something that uniquely identifies ThreadGroup for every JVM, example: - <source>TG_${__P(JVM_ID)}</source> - <figure image="thread_group_distributed.png"></figure> - where you pass a different JVM_ID property for each jmeter-server through <code><funclink name="__P()"/></code> function: - <source>-JJVM_ID=i</source> where <code>i</code> varies between 1 and the number of jmeter-server you are using. - - </p> - </subsection> </subsection> <subsection name="§-num;.2.2 General settings" anchor="configuration_general">