Bug 56708 - __jexl2 doesn't scale with multiple CPU cores
Summary: __jexl2 doesn't scale with multiple CPU cores
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.6
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2014-07-10 14:40 UTC by Mikhail Epikhin
Modified: 2014-07-12 17:48 UTC (History)
2 users (show)

adding threadLocal support (1.39 KB, patch)
2014-07-10 14:40 UTC, Mikhail Epikhin
Details | Diff
1024 threads are blocked on one jexl2 execute method (57.37 KB, application/x-gzip)
2014-07-10 15:16 UTC, Mikhail Epikhin

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Epikhin 2014-07-10 14:40:03 UTC
Created attachment 31806 [details]
adding threadLocal support

Hello comrades!

I have a problem with big testplan and many If controllers using jexl2 with complex expressions.
Many threads are locking on JexlEngine. So, JMeter support jdk 1.6+, maybe we should start to use ThreadLocal?:)

ThreadLocal support in java since 1.6 http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html

This simple patch scaleup overall throughput of my test. I think we can commit it and increase performance of logic controllers:)

What about add similar patches for other functions? It would be nice!
Comment 1 Mikhail Epikhin 2014-07-10 14:53:03 UTC
Method "getJexlEngine" should be static. My fault.
Comment 2 UbikLoadPack support 2014-07-10 14:56:27 UTC
Thanks for analysis and contribution.
Would it be possible to attach the proof of contention in the Bugzilla ?
Using ThreadLocal might impact memory usage negatively (note by the way it is used frequently in JMeter :-) ) even before JDK6.

Comment 3 Mikhail Epikhin 2014-07-10 15:16:18 UTC
Created attachment 31807 [details]
1024 threads are blocked on one jexl2 execute method
Comment 4 Mikhail Epikhin 2014-07-10 15:19:59 UTC
I can't attach test-case for NDA reasons. In test-case i have problems on throughput ~200rps. Applying patch increased throughput to 700rps and system under test are broken under load.
Comment 5 Mikhail Epikhin 2014-07-11 08:05:04 UTC
For decrease memory consumption we can use method setCache(int size) of JexlEngine. By default Jmeter have cache size 512 per jexl instance. We can decrease than parameter or set value from jmeter configs.
Comment 6 Philippe Mouawad 2014-07-12 13:25:09 UTC
Affects version from at least 2.5 up to 2.11
Comment 7 Philippe Mouawad 2014-07-12 13:32:30 UTC
Thanks for contribution.
Commited with addition of ThreadListener interface implementation to cleanup thread local at thread end.

If you can test nightly build and give feedback, it would be great.

Date: Sat Jul 12 13:30:51 2014
New Revision: 1609915

URL: http://svn.apache.org/r1609915
Bug 56708 - __jexl2 doesn't scale with multiple CPU cores
Bugzilla Id: 56708

Comment 8 Mikhail Epikhin 2014-07-12 17:48:23 UTC
Thank you, folks!:)