The Cost Of An "Empty" Transaction--Screencast

Is it worth to disable transaction (with e.g. @TransactionAttribute(TransactionAttributeType.NEVER)) on an EJB method for optimization purposes? Such micro-optimizations increase the complexity, but what is the actual benefit?

In this following screencast a Servlet was deployed with and without involving a UserTransaction and the performance difference was measured with JMeter.

Thanks for watching!

See also other screencasts at: or subscribe to

See you at Java EE Workshops at MUC Airport!

NEW online workshop: Web Components training (online)

Airport MUC workshops: Java EE 8, Java 9: Bootstrap, Effective, Architectures, Single Page Apps, Progressive Web Apps, HTML 5, ES 6, CSS 3 and Microservices

Podcast: and newsletter:

A book about rethinking Java EE Patterns


Hi Adam
Thanks for the video.

I have a question on JVM optimization for the transactions in this scenario.

You say that the second time the test ran it is a little bit faster and it might be that the JVM is optimized. Can you explain more? Because you changed code (added transaction) and redeployed?

Will it be a different scenario if you cleaned out the app from glassfish and redeploy?

Posted by Rentius on August 13, 2013 at 12:20 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments