High-Performance Java Persistence by Vlad Mihalcea

High-Performance Java Persistence by Vlad Mihalcea

Author:Vlad Mihalcea [Mihalcea, Vlad]
Language: eng
Format: epub, pdf
Published: 2016-02-05T15:03:42+00:00


Transactions

113

7.7 Application-level transactions

So far, the book focused on database transactions to enforce ACID properties. But from the application perspective, a business workflow might span over multiple physical database transactions, in

which case the database ACID guarantees will not be sufficient anymore.

A logical transaction may be composed of multiple web requests, including user think time, for

which reason it can be visualized as a long conversation.

In the following example, both Alice and a background batch process are concurrently modifying the same database record.

Figure 7.14: Stateless conversation loosing updates

Because Alice logical transaction encloses two separate web requests, each one associated with a separate database transaction, without an additional concurrency control mechanism, even the

strongest isolation level cannot prevent the lost update phenomena.

Spanning a database transaction over multiple web requests is prohibitive since locks would be

held during user think time, therefore hurting scalability. Even with MVCC, the cost of maintaining previous versions (that can lead to a large version graph) can escalate and affect both performance and concurrency.

In a highly concurrent environment, database transactions are bound to be as short

as possible. Application-level transactions require application-level concurrency control

mechanisms.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.