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 Workhop Effective WebApps without Frameworks is also coming to: MUC Airport.

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

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