Created attachment 31816 [details] implementation of critical section controller Hi folks! In my work i have tests with many users and threads, but sometimes i have requests, which shouldn't execute simultaneously on one user. For example, users changes settings in his profile, but only one user can change his information simultaneously. In default JMeter doesn't support this behavior. Critical Section Controller is a simple controller, which create lock with name (let us say his login/username) and other threads will block, if they try to go into the critical section with same name. For improvement of this concept we can add policies, such as "blocking lock", and "try lock" for powerful scenarios. I tried to use many bicycles with BeanShell, but all BeanShell scripts runs under lock on Interpreter and with named locks i have many deadlocks problems:) Bicycles with jsr223 better, but they are to complex. This concept is easy and clearly.
Hello Mikhail, Thanks for patch. I reviewed it rapidly, I think it only works within 1 JVM (so not in distributed test, right ?). It is rather an important limitation. Implementing a distributed system might be tricky but would be possible by making slaves ask master for lock. @dev team what's your opinion on incorporating this as-is and enhancing it for distributed testing later ? Regards Philippe M.
Yes, this concept work fine with one JVM. If you want to use something like that with multiple jmeter instances, than you need shard your dataset and use it separately. Distributed mechanism is to slow and have many overheads. I haven't any desire to write my own ZooKeeper / Paxos. It's too slow, too hard. And i don't want to install zookeeper quorum just for named locks for severals tests. It's overhead. It's complicated. I have many tests with high throughput (>100000rps), but most of tests (99.9%) runs from single machine. And in this case this bicycle works very well. We can implement option with multiple modes. Distributed and Single. But now, there are no neither one nor the other. Let's use though single mode. I'll tested this bicycle in non-contention scenario, and 1 native thread can handle ~300000rps on macbook air. It's good performance for this feature.
And with current architecture any paxos requests will impose serious delays, and using that on high throughput tests, or with many nodes will be very difficult, if not impossible. Just shard data. Just use simple solution. If you want single dataset, than use redis, it's better for that problem.
Hello Mikhail, Current patch is not working for me with trunk. Unlock is never called. What version did you test with ? Thanks
Created attachment 31828 [details] CriticalSectionController_v0.2 Hello! Sorry, first patch have a deadlock bug, if you interrupt test. I fixed that with that patch.
Date: Fri Jul 18 16:15:03 2014 New Revision: 1611691 URL: http://svn.apache.org/r1611691 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Bugzilla Id: 56728 Modified: jmeter/trunk/src/components/org/apache/jmeter/control/CriticalSectionController.java (props changed) jmeter/trunk/src/components/org/apache/jmeter/control/gui/CriticalSectionControllerGui.java (props changed) Date: Fri Jul 18 16:13:18 2014 New Revision: 1611689 URL: http://svn.apache.org/r1611689 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Bugzilla Id: 56728 Added: jmeter/trunk/src/components/org/apache/jmeter/control/CriticalSectionController.java (with props) jmeter/trunk/src/components/org/apache/jmeter/control/gui/CriticalSectionControllerGui.java (with props) Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/xdocs/changes.xml jmeter/trunk/xdocs/usermanual/component_reference.xml
Hello Mikhail, Thanks for patch 2, but it was still not working for me and code was strange: - Clearing lock map on thread end is wrong for me as it is shared among many threads which may have not ended - It was still blocking because lock was taken many times and only released one time I rewrote nearly all the controller but kept GUI class as is. You thorough tests are welcome. Regards Philippe M. @philmdot
Date: Fri Jul 18 16:17:03 2014 New Revision: 1611693 URL: http://svn.apache.org/r1611693 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Bugzilla Id: 56728 Modified: jmeter/trunk/bin/saveservice.properties
Date: Fri Jul 18 16:19:44 2014 New Revision: 1611695 URL: http://svn.apache.org/r1611695 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Bugzilla Id: 56728 Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
I was lost in broad daylight:) Thanks for your code! You better know JMeter sources.
Date: Fri Jul 18 17:02:56 2014 New Revision: 1611713 URL: http://svn.apache.org/r1611713 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Bugzilla Id: 56728 Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
Date: Sat Jul 26 21:18:27 2014 New Revision: 1613724 URL: http://svn.apache.org/r1613724 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Fix javadocs as per sebb notes on dev mailing list Bugzilla Id: 56728 Modified: jmeter/trunk/src/components/org/apache/jmeter/control/gui/CriticalSectionControllerGui.java Date: Sat Jul 26 21:18:59 2014 New Revision: 1613725 URL: http://svn.apache.org/r1613725 Log: Bug 56728 - New Critical Section Controller to serialize blocks of a Test Fix code and javadocs as per sebb notes on dev mailing list Bugzilla Id: 56728 Modified: jmeter/trunk/src/components/org/apache/jmeter/control/CriticalSectionController.java
*** Bug 43384 has been marked as a duplicate of this bug. ***
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3398