21
Narayana 5: The premier open source transaction manager JBug NCL: 12th May 2015 TOM JENKINSON

Narayana 5: The premier open source transaction manager

Embed Size (px)

Citation preview

Page 1: Narayana 5: The premier open source transaction manager

Narayana 5:The premier open source

transaction managerJBug NCL: 12th May 2015

TOM JENKINSON

Page 2: Narayana 5: The premier open source transaction manager

Agenda● Why you need a transaction manager● Using Narayana inside containers● New features in Narayana 5

Page 3: Narayana 5: The premier open source transaction manager

Why you need a transaction manager - a brief revision course

Page 4: Narayana 5: The premier open source transaction manager

My bank Your bank

Transactions - why?

My bank account Your bank account

?

Page 5: Narayana 5: The premier open source transaction manager

The properties of a transaction

There are many types of transaction models, they generally revolve around adherence to and relaxation of the so-called ACID properties:● Atomicity● Consistency● Isolation● Durability

Page 6: Narayana 5: The premier open source transaction manager

Transaction APIs

● Specifications:○ JSR-907 JTA 1.2○ OMG OTS 1.1○ OASIS WS-AT 1.2○ OASIS WS-BA 1.2○ X/Open TM○ rest-* REST-AT 2.0 draft 8

● Related:○ XA○ X/Open ATMI

Page 7: Narayana 5: The premier open source transaction manager

Transaction Manager

(Narayana)

Resource Manager(PostGres,

HornetQ, etc)

Application Programs (you)

XA

JTAJDBC JMS

X/Open DTP

Recovery Manager

Transaction Log

Page 8: Narayana 5: The premier open source transaction manager

2PC protocolXAResource xar1 = . . .XAResource xar2 = . . . TM.begin();

TM.enlist(xar1);xar1.start(xid1);

TM.enlist(xar2);xar2.start(xid2);

“xar1”.op(...);“xar2”.op(...);

TM.delist(xar1);xar1.end(xid1);

TM.delist(xar2);xar2.end(xid2);

TM.commit();xar1.prepare(xid1);xar2.prepare(xid2);xar1.commit(xid1);xar2.commit(xid2);

Page 9: Narayana 5: The premier open source transaction manager

Narayana proprietary APIs

● TxCore● TXoJ● Compensations Framework● STM● Utilities:

○ TransactionalDriver○ Tooling to query the transaction log

Page 10: Narayana 5: The premier open source transaction manager

Other terms

Transaction types:● Global● Distributed● LocalRecovery:● Bottom-up● Top-down

Page 11: Narayana 5: The premier open source transaction manager

Using Narayana inside containers

WildFly, Undertow, Docker, Tomcat

Page 12: Narayana 5: The premier open source transaction manager

WildFly

Fully integrated into WFLY● Provides JTA 1.2/JTS implementation● Provides REST-AT coordinator● Provides WS-AT/BA coordinator● Can be extended to provide an XATMI backend

for C applications

Page 14: Narayana 5: The premier open source transaction manager

REST-AT and Undertow

Start up a REST-AT coordinator in 3 lines!org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer server =

new org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer();

server.deploy(new org.jboss.jbossts.star.service.TMApplication(), "/");

server.start(Undertow.builder().addHttpListener(8080, "localhost"));

Page 15: Narayana 5: The premier open source transaction manager

JTA in Tomcat

We have two approaches for this1. Tight integration into Tomcat structure2. Running within the IronJacamar embedded

containerhttps://github.com/jbosstm/quickstart/tree/master/jca-and-tomcat

Page 16: Narayana 5: The premier open source transaction manager

New features in Narayana 5

Compensations Framework, NoSQL, STM

Page 17: Narayana 5: The premier open source transaction manager

Compensations FrameworkProvides JTA 1.2. like API:● @Compensatable● @TxCompensate● @TxConfirmWorks both locally and remotelyCurrently does not support recoveryhttp://jbossts.blogspot.co.uk/2013/05/compensating-transactions-when-acid-is.html

Page 18: Narayana 5: The premier open source transaction manager

NoSQL

In development● Atomic● Eventually consistent● Relaxes isolation● DurableUpdates to documents add in transactional data

Page 19: Narayana 5: The premier open source transaction manager

STM

A concurrency model for editing shared stateBroadly speaking can be broken into:● Optimistic Concurrency Control● Pessimistic Concurrency ControlThe difference is when locks are checkedTypically you have relaxed durability

Page 20: Narayana 5: The premier open source transaction manager

Other things we are working on

We have a prototype of a data-grid transaction logWe are coming up against CAP theorum for when to elect a recovery manager

Page 21: Narayana 5: The premier open source transaction manager

Questions? Links!

Our site: http://narayana.ioOur code: https://github.com/jbosstm/Read our opinions: http://jbossts.blogspot.co.uk/Chat to us: http://webchat.freenode.net/?channels=jbosstsQuestion us: https://developer.jboss.org/en/jbosstm/