Bug 56728 - New Critical Section Controller to serialize blocks of a Test
Summary: New Critical Section Controller to serialize blocks of a Test
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: Nightly (Please specify date)
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords: PatchAvailable
: 43384 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-16 11:30 UTC by Mikhail Epikhin
Modified: 2014-10-29 13:39 UTC (History)
3 users (show)



Attachments
implementation of critical section controller (12.37 KB, patch)
2014-07-16 11:30 UTC, Mikhail Epikhin
Details | Diff
CriticalSectionController_v0.2 (13.00 KB, patch)
2014-07-18 04:23 UTC, Mikhail Epikhin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Epikhin 2014-07-16 11:30:54 UTC
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.
Comment 1 Philippe Mouawad 2014-07-16 14:59:40 UTC
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.
Comment 2 Mikhail Epikhin 2014-07-16 15:15:23 UTC
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.
Comment 3 Mikhail Epikhin 2014-07-16 15:26:41 UTC
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.
Comment 4 Philippe Mouawad 2014-07-17 22:18:19 UTC
Hello Mikhail,
Current patch is not working for me with trunk.
Unlock is never called.

What version did you test with ?
Thanks
Comment 5 Mikhail Epikhin 2014-07-18 04:23:39 UTC
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.
Comment 6 Philippe Mouawad 2014-07-18 16:22:45 UTC
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
Comment 7 Philippe Mouawad 2014-07-18 16:27:32 UTC
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
Comment 8 Philippe Mouawad 2014-07-18 16:27:48 UTC
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
Comment 9 Philippe Mouawad 2014-07-18 16:30:50 UTC
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
Comment 10 Mikhail Epikhin 2014-07-18 16:54:22 UTC
I was lost in broad daylight:) Thanks for your code! You better know JMeter sources.
Comment 11 Philippe Mouawad 2014-07-18 17:06:01 UTC
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
Comment 12 Philippe Mouawad 2014-07-26 21:20:54 UTC
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
Comment 13 Philippe Mouawad 2014-10-29 13:39:28 UTC
*** Bug 43384 has been marked as a duplicate of this bug. ***
Comment 14 The ASF infrastructure team 2022-09-24 20:37:57 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3398