Bug 58784

Summary: Use invokeLater in JMeterUtils#runSafe
Product: JMeter Reporter: Felix Schumacher <felix.schumacher>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.13   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Use invokeLater instead of invokeAndWait
Use invokeLater instead of invokeAndWait everywhere except in proxycontrol

Description Felix Schumacher 2015-12-30 15:13:28 UTC
Created attachment 33386 [details]
Use invokeLater instead of invokeAndWait

The usage of invokeAndWait in runSafe will slow down the samplers in gui mode, when listeners are used.

When running with 1000 threads in 500 loops using just a simple java sampler (0ms wait) and a Summary Report the version with invokeAndWait will do about 30.000 req/s and the one with invokeLater around 100.000 req/s. (Tested on my ubunutu notebook with local X).

When run over remote X the version with invokeAndWait can perform a lot worse, due to heavy lock contention.

The proposed patch ignores the potentially thrown exceptions, as they are probably ignored by the other usages of invokeLater in other parts of jmeter code.
Comment 1 Felix Schumacher 2016-01-01 12:41:35 UTC
Created attachment 33390 [details]
Use invokeLater instead of invokeAndWait everywhere except in proxycontrol

As pointed out by Phillip, the proxy control has problems when runSafe is asynchronous. So leave runSafe synchronous per default, but add a version which is configurable, whether it should do the runnable synchronously or asynchronously.
Comment 2 Felix Schumacher 2016-01-01 12:53:59 UTC
Date: Fri Jan  1 12:51:20 2016
New Revision: 1722493

URL: http://svn.apache.org/viewvc?rev=1722493&view=rev
Log:
Make JMeterUtils#runSafe sync/async awt invocation configurable and
change the visualizers to use the async version.

Bugzilla Id: 58784

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/AssertionVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ComparisonVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/DistributionGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/GraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/MailerVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/RespTimeGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SplineVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/TableVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/xdocs/changes.xml
Comment 3 Felix Schumacher 2016-01-01 19:23:58 UTC
Date: Fri Jan  1 19:21:40 2016
New Revision: 1722543

URL: http://svn.apache.org/viewvc?rev=1722543&view=rev
Log:
Correct (flip) sync/async usage of JMeterUtils#runSafe as noted by pmouawad.

Followup to r1722493

Bugzilla Id: 58784