[jbossts-issues] [JBoss JIRA] (JBTM-2209) Use Deque for ThreadActionData

Michael Musgrove (JIRA) issues at jboss.org
Thu Sep 11 15:22:20 EDT 2014


    [ https://issues.jboss.org/browse/JBTM-2209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001605#comment-13001605 ] 

Michael Musgrove commented on JBTM-2209:
----------------------------------------

OK I have added a bit of asbestos to the fireguard ;-) and created 2 JMH benchmarks for comparing the use of Stack versus Deque in ThreadActionData. My findings are:

* with benchmark 1 Deque gives an 3.8% (5.8%) improvement using 1 (10) threads
* with benchmark 2 Deque gives an 3.8% (4.6%) improvement using 1 (10) threads

I ran each benchmark on my laptop for 5 mins (running each test twice using either 1 or 10 threads to do the work on my quad core laptop (with a 1s warmup). I watched the CPU usage to ensure that it was roughly constant (100% for the 1 thread test and about 400% for the 10 thread test).

I think this is good enough to accept the PR.

The actual benchmark is: 
https://github.com/mmusgrov/performance/blob/JBTM-1453/narayana/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/atomicaction/CheckedActionTest.java

In more detail:

Benchmark 1: com.hp.mwtests.ts.arjuna.atomicaction.CheckedActionTest.testCheckedAction:  Start 10 AtomicActions and for each action add a synchronization and 5 child threads and then suspend the action. Then, for each action resume it, remove its child threads and commit it.

Benchmark 2: com.hp.mwtests.ts.arjuna.atomicaction.CheckedActionTest.testThreadActionData: Start 2 AtomicActions and manipulate their action hierarchy using currentAction(), restoreActions, popAction and purgeActions

{quote}
Test 1 (Stack using 1 thread for 300s): 45423 ops/s
Test 1 (Stack using 10 threads for 300s): 108201 ops/s
Test 2 (Stack using 1 thread for 300s): 651056 ops/s
Test 2 (Stack using 10 threads for 300s): 1443719 ops/s

Test 1 (Deque using 1 thread for 300s): 47200 ops/s
Test 1 (Deque using 10 threads for 300s): 114613 ops/s
Test 2 (Deque using 1 thread for 300s): 676561 ops/s
Test 2 (Deque using 10 threads for 300s): 1511950 ops/s
{quote}

Note I cherry picked Jespers Deque implementation on master (5.0.4.Final-SNAPSHOT todays version) and for the Stack implementation I used 5.0.3.Final-SNAPSHOT (the one just before it was tagged).

> Use Deque for ThreadActionData
> ------------------------------
>
>                 Key: JBTM-2209
>                 URL: https://issues.jboss.org/browse/JBTM-2209
>             Project: JBoss Transaction Manager
>          Issue Type: Sub-task
>          Components: Transaction Core
>            Reporter: Jesper Pedersen
>            Assignee: Michael Musgrove
>         Attachments: Test.java
>
>
> Note, there are other usages of java.util.Stack in the code base that could be changed as well



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)


More information about the jbossts-issues mailing list