2008/06/13

SpringOne 2008 - Spring Transaction choices for Performance by Jürgen Höller

Tune with the @Transactional annotation:
  • propagation: "requires", "requires-new" or, the spring-specific, "nested" (=uses save points)
  • isolation level: default: read committed
  • set the readonly flag --> hint for runtime optimization.
Prefer native JDBC transactions over XA transactions:
  • XA is difficult to setup
  • run a transaction coordinator
  • XA JDBC driver
  • XA Message Broker
  • put the XA recovery log to a reliable log storage
  • XA has a significant run time overhead
  • two phase commit
  • state tracking
  • recovery
  • on restart: complete pending commits/rollbacks --> read the "reliable recovery log"
Check if you really need XA! Prefer the use of a native transaction or combine two native transaction, with some small extra safety provisions. E. g. Usually the "exactly once" guarantee of an XA JMS can be relaxed --> use a native JMS transaction and detect duplicate messages. --> much higher throughput.

No comments: