Bug 53520 - JSR223 Elements : Use Compilable interface to improve performances on File scripts
JSR223 Elements : Use Compilable interface to improve performances on File sc...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.7
All All
: P2 enhancement (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on: 53365
Blocks:
  Show dependency tree
 
Reported: 2012-07-07 22:35 UTC by Philippe Mouawad
Modified: 2012-07-08 21:05 UTC (History)
1 user (show)



Attachments
Test plan used for bench (7.80 KB, application/xml)
2012-07-08 20:46 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-07-07 22:35:49 UTC
JSR233 proposes Compilable interface and many ScriptEngine implement it

I think we should improve this part by doing something like that:
- We could compile script code
- then cache it (which key to use ? add a new property ? use Sampler Name ? use file script name ? use a hash of Script code ?)

I tested this approach:
- It fixes the memory leak issue
- It gives fabulous performance enhancements

But doing so means script code must not contains variables which would forbid caching the compiled code unless we hash script code to see if it changes but this will introduce a performance issue on this hashing.

[reply] [-] Comment 5 Sebb 2012-06-30 08:58:13 UTC

The scripting elements were intended mainly for prototyping and ad-hoc testing; the intention being that the script would often be turned into a Java class if necessary for performance. So performance and memory consumption are not as important as for the Java classes.

That's not to say that improvements aren't useful, but such improvements must not affect backwards compatibility; in particular variables must be supported as before.

The JSR223 test elements support reading the script from a file, and parameters can be passed to the file, so one way to improve performance without affecting compatibility would be to cache the compiled form of a file using the key of file name+modification time.

The same could apply to the ScriptEngineManager: cache that if using a file.

This would guarantee compatibility, and probably not be too difficult to implement, nor be difficult for users to convert their test elements.
Comment 1 Philippe Mouawad 2012-07-08 20:28:48 UTC
Date: Sun Jul  8 20:27:52 2012
New Revision: 1358829

URL: http://svn.apache.org/viewvc?rev=1358829&view=rev
Log:
Bug 53520 - JSR223 Elements : Use Compilable interface to improve performances on File scripts
Bugzilla Id: 53520

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/JSR223Assertion.java
    jmeter/trunk/src/components/org/apache/jmeter/extractor/JSR223PostProcessor.java
    jmeter/trunk/src/components/org/apache/jmeter/modifiers/JSR223PreProcessor.java
    jmeter/trunk/src/components/org/apache/jmeter/timers/JSR223Timer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/JSR223Listener.java
    jmeter/trunk/src/core/org/apache/jmeter/util/JSR223TestElement.java
    jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JSR223Sampler.java
    jmeter/trunk/xdocs/changes.xml
Comment 2 Philippe Mouawad 2012-07-08 20:46:40 UTC
Created attachment 29040 [details]
Test plan used for bench
Comment 3 Philippe Mouawad 2012-07-08 20:48:26 UTC
Results of Test plan run on my Computer:
- JMeter 2.8 before this feature: Throughput => 75 samples/sec
- JMeter 2.8 with this feature : Throughput => 253 samples/sec
Comment 4 Philippe Mouawad 2012-07-08 20:51:57 UTC
Date: Sun Jul  8 20:50:40 2012
New Revision: 1358831

URL: http://svn.apache.org/viewvc?rev=1358831&view=rev
Log:
Bug 53520 - JSR223 Elements : Use Compilable interface to improve performances on File scripts
Bugzilla Id: 53520

Modified:
    jmeter/trunk/bin/jmeter.properties
Comment 5 Philippe Mouawad 2012-07-08 21:05:06 UTC
Date: Sun Jul  8 21:02:58 2012
New Revision: 1358835

URL: http://svn.apache.org/viewvc?rev=1358835&view=rev
Log:
Bug 53520 - JSR223 Elements : Use Compilable interface to improve performances on File scripts
Bugzilla Id: 53520

Modified:
    jmeter/trunk/xdocs/usermanual/component_reference.xml