Hybrid STM/HTM for Nested Transactions in Java
Keith Chapman Purdue U Tony Hosking ANU/Data61, Purdue U Eliot Moss UMass
Hybrid STM/HTM for Nested Transactions in Java Keith Chapman Tony - - PowerPoint PPT Presentation
Hybrid STM/HTM for Nested Transactions in Java Keith Chapman Tony Hosking Eliot Moss Purdue U ANU/Data61, Purdue U UMass Motivation STM has been around for ages But STM is slow Commodity hardware for transactions available now But
Keith Chapman Purdue U Tony Hosking ANU/Data61, Purdue U Eliot Moss UMass
STM has been around for ages
Commodity hardware for transactions available now
Out goal: Accelerate STM with HTM when possible
Allow composition of transactions Two flavors
XJ Language
The implementation supports hybrid transactions
Uses an Optimistic-reads / Pessimistic-writes protocol
Txn Log
Version # Txn ID 1
One metadata word for every object
T1 Log Check Mode T1 Read T1 Validate T1 Commit
T1 1 1
T1 Log Check Mode T1 Write T1 Commit
T1 Log T2 Log T1 Read T2 Write T1 Validate T1 Abort
T2 1
STM – HTM conflicts detected by lock word accesses
Open / Boosted Atomic Method Body
Acquire abstract locks Release abstract locks
If top level transaction
Open / Boosted Atomic Method Body
Acquire abstract locks Log abstract locks
If nested transaction
Log undo operations
Open / Boosted Atomic Method Body
Validate abstract locks
Open / Boosted Atomic Method Body
Acquire abstract locks Log abstract locks
If top level is HTM
Log undo operations
physical words in the abstract locking data structure — otherwise they could not detect the conflict
accesses to it are reads
data structure
Open / Boosted Atomic Method Body
Validate abstract locks
STM needs logging HTM doesn't Different actions during read/write Different actions for abstract locks HTM should fall back to STM Maintain separate HTM and STM versions of methods
HTM 4-5 times faster than STM
XJ source code XJ run-time library XJ Compiler standard Java bytecode XJ Rewriter bytecode + run-time calls HTM-enabled JVM
compile load run
Kept to a minimum Modifications done on OpenJDK:
Had to go through several hoops to get HTM to work with HotSpot’s
Micro-benchmarks to evaluate synchronization performance on various data structures Added ability to run multiple operations within a single transaction (group size) Included XJ versions of the benchmarks
48-way, Intel Xeon E5-2690 v3 machine with 2 sockets of 12 hyperthreaded cores
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48
Open nested Closed nested
Group size 1
5% Updates
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Group size 1 Group size 2
Open nested Closed nested 5% Updates
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Group size 1 Group size 2 Group size 4
Open nested Closed nested 5% Updates
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Group size 1 Group size 2 Group size 4 Group size 8
Open nested Closed nested 5% Updates
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Group size 1 Group size 2 Group size 4 Group size 8 Group size 16
Open nested Closed nested 5% Updates
Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Throughput (Normalized) 0.2 0.4 0.6 0.8 1 Threads 1 2 4 8 12 16 20 24 28 32 36 40 44 48 Group size 1 Group size 2 Group size 4 Group size 8 Group size 16 Group size 32
Open nested Closed nested 5% Updates
50 100 150 200 1 2 4 8 12 16 20 24 28 32 36 40 44 48 1 2 4 8 12 16 20 24 28 32 36 40 44 48 1 2 4 8 12 16 20 24 28 32 36 40 44 48
Group size 1 Group size 2 Group size 4
committed ops and aborted txns (106)
closed htm commits
closed stm commits htm aborts
STM and HTM can co-exist for nested transactions in Java
When it works, HTM is ~4-5× faster than STM Open nesting increases the envelope of effectiveness for HTM Production VM would need deeper modification
http://dx.doi.org/10.1145/2983990.2984029
dx.doi.org/10.1145/2998415.2998417