667514 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 14 Messages: 14 Messages: 14 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

ACID is Good. Take it in Short Doses

Posted by: Nuno Teixeira on October 22, 2004 DIGG
This article is about why ACID is good for you, why ACID doesn't work in long doses, why you shouldn't give up and what concepts, models and technologies you can take in longer doses.

Conclusions
We have discussed why ACID is good, why ACID does not work in long doses, why you should not give up and what concepts, models and technologies you can take in longer doses. We used the simple example of planning a trip to illustrate a long-lived activity. We focused on the simple concept of a Saga as one way of approaching the trip planning activity. But when a Saga is extended, we end up with more generalized workflow models.
We next turned to forthcoming infrastructure to support activities. In particular, we focused on the J2EE Activity Service as defined by JSR-95. We look forward to support for activities in application servers.
Finally, we described how to implement our trip planning activity as a Saga with the J2EE Activity Service. The Activity Service is a more general mechanism than that. Other trip planning behaviors besides atomicity can be achieved using the Activity Service. We leave that as an exercise for you.


Read ACID is Good. Take it in Short Doses

Threaded replies

·  ACID is Good. Take it in Short Doses by Nuno Teixeira on Fri Oct 22 02:11:18 EDT 2004
  ·  Good Article by Saroj Singh on Fri Oct 22 03:26:58 EDT 2004
  ·  ACID is Good. Take it in Short Doses by han theman on Fri Oct 22 07:00:09 EDT 2004
    ·  ACID is Good. Take it in Short Doses by Greg Pavlik on Fri Oct 22 09:43:29 EDT 2004
      ·  ACID is Good. Take it in Short Doses by Mark Little on Fri Oct 22 10:02:51 EDT 2004
      ·  Activity Service by Guy Pardon on Sat Oct 23 11:10:59 EDT 2004
        ·  Long TX == temporary legalizing unstable state by Alex V on Sat Oct 23 12:37:00 EDT 2004
  ·  Has anyone seen JAIN-SLEE? by Pawan Kumar on Fri Oct 22 11:28:32 EDT 2004
    ·  re: JAIN-SLEE by Ivelin Ivanov on Tue May 24 15:16:13 EDT 2005
  ·  ACID is Good. Take it in Short Doses by Michael Jouravlev on Fri Oct 22 12:05:57 EDT 2004
    ·  ACID is Good. Take it in Short Doses by Mark Little on Mon Oct 25 07:08:03 EDT 2004
  ·  compensating transactions by peter lin on Fri Oct 22 12:41:24 EDT 2004
    ·  Compensation and workflow by Guy Pardon on Sat Oct 23 04:36:12 EDT 2004
      ·  thanks for the link by peter lin on Sat Oct 23 23:59:43 EDT 2004
    ·  compensating transactions by Mark Little on Mon Oct 25 07:12:28 EDT 2004
  Message #143451 Post reply Post reply Post reply Go to top Go to top Go to top

Good Article

Posted by: Saroj Singh on October 22, 2004 in response to Message #143445
Thanks to Mark Little and Bruce Martin for this well written article which articulates the need for Activity Service Support in J2EE Application Environment.

it would be exciting to see how this goes forward.

-Saroj

  Message #143464 Post reply Post reply Post reply Go to top Go to top Go to top

ACID is Good. Take it in Short Doses

Posted by: han theman on October 22, 2004 in response to Message #143445
The need for a workflow engine emerges...

  Message #143495 Post reply Post reply Post reply Go to top Go to top Go to top

ACID is Good. Take it in Short Doses

Posted by: Greg Pavlik on October 22, 2004 in response to Message #143464
A thought provoking article. An observation, though: while I know it's not a pure transactional system, it seems to me that the industry (vendors and customers) is converging on a BPEL-based approach to solving many of the scenarios that people have traditionally positioned extended transactions to resolve. One reason may be that many proposed extended transaction models like sagas tend to require the interleaving of application logic with transaction management functions (with sagas, compensators are generally pure application domain logic; the extreme example of this is BTP). It will be interesting to see how things play out over the next few years, but I think application structuring on infrastructure like the Activity service is unlikely to become a popular model. On the other hand, I predict that BPEL engines will be very widely deployed.

It's also worth mentioning that BPEL does build on concepts from extended transaction models including sagas and open nested transactions.

Again, nice work.

Greg

  Message #143498 Post reply Post reply Post reply Go to top Go to top Go to top

ACID is Good. Take it in Short Doses

Posted by: Mark Little on October 22, 2004 in response to Message #143495
A thought provoking article. An observation, though: while I know it's not a pure transactional system, it seems to me that the industry (vendors and customers) is converging on a BPEL-based approach to solving many of the scenarios that people have traditionally positioned extended transactions to resolve. One reason may be that many proposed extended transaction models like sagas tend to require the interleaving of application logic with transaction management functions (with sagas, compensators are generally pure application domain logic; the extreme example of this is BTP). It will be interesting to see how things play out over the next few years, but I think application structuring on infrastructure like the Activity service is unlikely to become a popular model. On the other hand, I predict that BPEL engines will be very widely deployed.It's also worth mentioning that BPEL does build on concepts from extended transaction models including sagas and open nested transactions.Again, nice work.Greg

I think that for anything other than simple Saga applications, you need something that will look very much like a *reliable* workflow engine. Now, whether that's BPEL or not depends upon the environment you're operating in. The way BPEL is going in OASIS at the moment it's often difficult to see how it'll be useful in Web Services, let alone J2EE ;-)

But I think from a pragmatic stand point, you're right in that BPEL will/should become the standard. It would be good for it to be less Web Services specific though. But perhaps that's a tooling thing anyway.

Mark.

  Message #143517 Post reply Post reply Post reply Go to top Go to top Go to top

Has anyone seen JAIN-SLEE?

Posted by: Pawan Kumar on October 22, 2004 in response to Message #143445
JAIN-SLEE (Java API for Integrated Networks, Service Logic Execution Environment), although driven by telecom industry is applicable to any event-oriented environment. It is a completely event-based architecture.

Is there any direct or indirect association between the two?

Read more about JAIN-SLEE at http://jainslee.org or http://java.sun.com/products/jain/

  Message #143521 Post reply Post reply Post reply Go to top Go to top Go to top

ACID is Good. Take it in Short Doses

Posted by: Michael Jouravlev on October 22, 2004 in response to Message #143445
Many databases and some application servers weaken serializability with their so-called isolation levels.
"So-called"? Aren't they defined in SQL standard? SQL2 defined four standard isolation levels more than a decade ago.
The weaker isolation levels are not the same from one database to another.
Actual implementation of SERIALIZABLE isolation level (ok, of SERIALIZABLE keyword) can be different as well, and some databases may not support it at all.
This requires you to reason about using inconsistent data and this is hard. You have to use application knowledge to argue that a transaction reading an inconsistent, possibly to be rolled-back value, doesn?t matter to the correctness of the application.
Unless the transaction isolation level is DIRTY READ, the value is absolutely not "possibly to be rolled-back". If you are talking about inconsistent updates or phantom data, this applies only to the case when the second transaction makes multiple reads. This is important for multiuser desktop applications, but I would say that this does not make a big difference for a web application. Database transaction usually is not kept opened during a whole client session to increase concurrency (this article is exactly about that). So, each HTTP request usually starts a new database transaction and immediately commits it (within possibly the same application transaction, here is where EJB may help). Each transaction usually makes only one read or update. Thus there is no difference would the value change or not, because it is read only once, and this is a committed value unless for some strange reason DBA set isolation level to DIRTY READ.
In the example, if a transaction reserves the last car, a second transaction can observe that fact and conclude there are no cars available. But if later we compensate for the first transaction by canceling the reservation, the second transaction has observed an inconsistent state.
To notice the change in data the second transaction must be long-lived and must reread data. Why would we design a long-lived multiread transaction, if we already decided to go with short ones for update? More realistically, the second transaction will start, observe that there are no cars available and will return to a user with "Nothing available, try again later". Or, if database designer were a little smarter, the second transaction would read "Reserved but not confirmed" flag and would tell a user "Some cars may be available later, try in N minutes", where N = M - K, where M is average time spent by a user from starting reservation to its finish, and K is the length of the current user session.
[By using HLS,] if at any point a transaction rolls back, the CompletionSignalSet is responsible for ensuring that the enclosing activity must fail, triggering any remaining compensation transactions.
This support from application server is nice, but as I see nothing changes on the database level. Which means, that if compensating database transaction fails, system becomes inconsistent. Thus, HLS is just a convenient framework, but it does not solve the original problem.

  Message #143531 Post reply Post reply Post reply Go to top Go to top Go to top

compensating transactions

Posted by: peter lin on October 22, 2004 in response to Message #143445
the article was good, but kinda wished it went further into compensating transactions. though writing about compensating transactions is not easy. especially if you change the scenario from travel to hedge fund.

the new JSR looks like it might make long-lived processes a bit easier to handle. it's nice to have informative stuff in between the fluff pieces like state of java platform.

  Message #143608 Post reply Post reply Post reply Go to top Go to top Go to top

Compensation and workflow

Posted by: Guy Pardon on October 23, 2004 in response to Message #143531
the article was good, but kinda wished it went further into compensating transactions. though writing about compensating transactions is not easy. especially if you change the scenario from travel to hedge fund.the new JSR looks like it might make long-lived processes a bit easier to handle. it's nice to have informative stuff in between the fluff pieces like state of java platform.

Hi,

Yes, an article focusing on compensation would be nice. I am thinking of writing one myself.

Compensating transactions have been studied in minute detail in the literature. To name an example in the context of web services, there is this research on compensating transactions in which I was involved in a previous life. At Atomikos we're still busy integrating this technology in our commercial product line.

The tricky part is how to expose compensation to the application logic (someone has to provide the compensation logic). This will have to be done in a way that is accepted by the business models for web service partners. At this point I think it is unrealistic to assume that there is a workflow engine (located somewhere on the Internet) that will take care of this. This is because the compensation is closely tied to the integrity of the business data of a particular web service. Consequently, assuming a loose federation of web services, no business will want to 'outsource' that integrity to another web service.

To use the saga example mentioned in Mark and Bruce's article: would one want to trust some other party to invoke all the compensations in the exact reverse order? Probably not.

Best,

Guy Pardon
The Transaction Management Company

  Message #143624 Post reply Post reply Post reply Go to top Go to top Go to top

Activity Service

Posted by: Guy Pardon on October 23, 2004 in response to Message #143495
Hi Greg,
A thought provoking article. An observation, though: while I know it's not a pure transactional system, it seems to me that the industry (vendors and customers) is converging on a BPEL-based approach to solving many of the scenarios that people have traditionally positioned extended transactions to resolve.

This is probably going to be more of a matter of business policies than something else, but I think it really depends on the application. Some existing business models already use a two-phase approach (e.g. reserve a flight, then confirm your booking). The BTP or WS-Activity models seem almost a natural fit, better than BPEL IMO.

In addition, 'abusing' workflow (pardon the term) to deal with transactional matters means that the workflow modeler needs to explicity foresee both the compensations and all possible combinations thereof. This doesn't scale well, it is error-prone and difficult to maintain. In the end, it might turn out much more expensive than anything else (linking back to Bruce and Mark's article: it would again mean that errors, exceptions an crashes are resolved by the application).
It will be interesting to see how things play out over the next few years, but I think application structuring on infrastructure like the Activity service is unlikely to become a popular model.

I certainly agree with you here. Powerful as it is, the activity service is probably more something that the BPEL engines will use internally, but I don't see how the regular Java developer would use it. Speaking from our past experience at Atomikos: we have gone out of our way to make the relatively simple JTA API as easy to use as possible, because many people found it cumbersome. And I have yet to meet the first regular Java developer who knows or understands the OTS, to give another example.

Best,

Guy Pardon
Atomikos: The Transaction Management Company

  Message #143626 Post reply Post reply Post reply Go to top Go to top Go to top

Long TX == temporary legalizing unstable state

Posted by: Alex V on October 23, 2004 in response to Message #143624
I would like to propose difinition of
"long transaction" as temporary legalization of
high-level inconsistent state.

temporary == within specified time this state
must be transferred into stable state.

legalization == can be defined in business terms
and must be aproved by business process owner.

high-level inconsistent == means inconsistent from
over-all business point of view. No PK-FK violations,
no resources locking.

Now a question, what is more important:

1. define set of "big transactions" spanning
several intermediate states, like flow engines
works, or

2. define set of state transition rules, like
state machine and rule engine.

Of cource, "Time" (cron, timer) is important
player in both cases.

IMHO, option 1 is more frendly for analysis and
use case definition, but option 2 is more scalable
on technical level.

For example, by option 2, we can define:
-- within 15 min state A(car-hotel-no_ticket)
must be tranfered into B(no_car-no_hotel-no_ticket)

According option 1, we have to define several
transactions leading to state A with
[unnessesary different]
scenarios of A-B transition after 15 min.

As usual, thruth is somewhere in between...

Alex V.

  Message #143636 Post reply Post reply Post reply Go to top Go to top Go to top

thanks for the link

Posted by: peter lin on October 23, 2004 in response to Message #143608
Hi,Yes, an article focusing on compensation would be nice. I am thinking of writing one myself.Compensating transactions have been studied in minute detail in the literature. To name an example in the context of web services, there is this research on compensating transactions in which I was involved in a previous life. At Atomikos we're still busy integrating this technology in our commercial product line.The tricky part is how to expose compensation to the application logic (someone has to provide the compensation logic). This will have to be done in a way that is accepted by the business models for web service partners. At this point I think it is unrealistic to assume that there is a workflow engine (located somewhere on the Internet) that will take care of this. This is because the compensation is closely tied to the integrity of the business data of a particular web service. Consequently, assuming a loose federation of web services, no business will want to 'outsource' that integrity to another web service. To use the saga example mentioned in Mark and Bruce's article: would one want to trust some other party to invoke all the compensations in the exact reverse order? Probably not.Best,Guy PardonThe Transaction Management Company

I downloaded the article and will read it. thanks for providing the link.

  Message #143719 Post reply Post reply Post reply Go to top Go to top Go to top

ACID is Good. Take it in Short Doses

Posted by: Mark Little on October 25, 2004 in response to Message #143521
Actual implementation of SERIALIZABLE isolation level (ok, of SERIALIZABLE keyword) can be different as well, and some databases may not support it at all.

Agreed, but that kind of level isn't suitable for this article. The aim of the article was to bring the issue of ACID transactions and their shortcomings to as wide an audience as possible.
Unless the transaction isolation level is DIRTY READ, the value is absolutely not "possibly to be rolled-back".

Again this is a language issue. If you're looking for a technical paper with all of the details, then take a look at the references. Remember, this paper is intended only to wet the appetite.
If you are talking about inconsistent updates or phantom data, this applies only to the case when the second transaction makes multiple reads. This is important for multiuser desktop applications, but I would say that this does not make a big difference for a web application. Database transaction usually is not kept opened during a whole client session to increase concurrency (this article is exactly about that). So, each HTTP request usually starts a new database transaction and immediately commits it (within possibly the same application transaction, here is where EJB may help). Each transaction usually makes only one read or update.

It really depends on your experiences, which in this case seem counter to the rest of the industry. Take a look at the OASIS WS-CAF work, or the IBM/MSFT/BEA WS-Atomic Transaction or WS-Business Activity specifications. If you disagree with the models on which they are based (and hence the assumptions), then get involved.
To notice the change in data the second transaction must be long-lived and must reread data.

Not true. The example says that the second transaction has terminated and gone and done something based on that (now incorrect) data it read. This is the traditional case of cascade abort.
This support from application server is nice, but as I see nothing changes on the database level. Which means, that if compensating database transaction fails, system becomes inconsistent. Thus, HLS is just a convenient framework, but it does not solve the original problem.

Compensation transactions aren't easy to write and manage, but they do provide suitable functionality in the right case. As we tried to show, it's important to use the right tool for the right job. The Activity Service definitely doesn't solve the problem, but hopefully it provides a good starting point for people to build on.

  Message #143720 Post reply Post reply Post reply Go to top Go to top Go to top

compensating transactions

Posted by: Mark Little on October 25, 2004 in response to Message #143531
the article was good, but kinda wished it went further into compensating transactions. though writing about compensating transactions is not easy. especially if you change the scenario from travel to hedge fund.the new JSR looks like it might make long-lived processes a bit easier to handle. it's nice to have informative stuff in between the fluff pieces like state of java platform.

I agree on both counts ;-)

If you're particularly interested in Web Services and compensations, take a look at the following:

http://www.sys-con.com/webservices/articleprint.cfm?id=737
http://www-106.ibm.com/developerworks/webservices/library/ws-comproto/
http://www.sys-con.com/webservices/articleprint.cfm?id=622
http://www.sys-con.com/webservices/articleprint.cfm?id=587
http://www.arjuna.com/library/technical/2004-06-SIGMOD2004-WebServicesTransactionsModels-paper.pdf
http://www.arjuna.com/library/technical/2003-07-HPTS-FullCircleForWebServicesTransactions.pdf

  Message #171791 Post reply Post reply Post reply Go to top Go to top Go to top

re: JAIN-SLEE

Posted by: Ivelin Ivanov on May 24, 2005 in response to Message #143517
JAIN-SLEE Activity Contexts are conceptually similar. However they are intended for use in environments with transaction volume in the order of 1000s/sec where each individual request is sub 100ms. I would expect that JSR 95 would add a few paragraphs in reference to JSR 22 to acknowledge the commonalities and explain the differences.

If you are further interested in open source SLEE implementations, take a look at mobicents.org.

Ivelin Ivanov

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map