Adam Bien's Weblog
How To Deal With Transaction Isolation Levels?
Transaction Isolation is the "I" in ACID and defines the visibility of changes in concurrent transactions.
Serializable is the highest value and ensures absolute consistency.
Read Uncommitted provides the highest concurrency with low consistency. NONE comes with no consistency and indicates the lack of transaction support.
The transaction consistency does influence the business logic and has to be discussed with domain experts.
A low risk approach to set a proper Isolation Level is:
- Set the highest possible Isolation Level (
- Perform Stress Tests and measure the impact
- If the required throughput / performance cannot be met or deadlock occurs, escalate the problem, talk to domain experts and either change the business logic, or lower the Isolation Level
Thanks Pavan Madiraju for the question!
[See also an in-depth discussion in the "Real World Java EE Patterns--Rethinking Best Practices" book (Second Iteration, "Green Book"), page 19 in, chapter "The Concurrency Problem"]
NEW workshop: Microservices with Java EE 7 and Java 8, January 26th, 2015, Airport Munich Tweet Follow @AdamBien