Chapter 1. Introduction

Table of Contents

Why Transactions?
Transaction Benefits
A Note on System Failure
Application Requirements
Multi-threaded and Multi-process Applications
Recoverability
Performance Tuning

This book provides a thorough introduction and discussion on transactions as used with Berkeley DB XML (BDB XML). It begins by offering a general overview to transactions, the guarantees they provide, and the general application infrastructure required to obtain full transactional protection for your data.

This book also provides detailed examples on how to write a transactional application. Both single threaded and multi-threaded (as well as multi-process applications) are discussed. A detailed description of various backup and recovery strategies is included in this manual, as is a discussion on performance considerations for your transactional application.

You should understand the concepts from the Getting Started with Berkeley DB XML guide before reading this book.

Why Transactions?

It is entirely possible that your application does not require transactions, and that you can therefore skip this manual. That is, for what applications are transactions useful?

It is true that applications which are mostly involved in read-only access to their containers can and probably should avoid transactions. But even applications that perform a lot of container writes might be able to skip using transactions.

If any of the following conditions are true, then you should consider using transactions, and so need to read this manual:

  • You need to perform multiple modifications to your containers in such a way as all the modifications succeed, or they all fail.

  • You are writing an application that might attempt to update the same document simultaneously from multiple threads or even processes.

  • Your application needs to perform long-running document updates — updates that could take minutes or even hours to complete — and you want to be sure that the document is left in a consistent state at the end of the update, regardless of whether the update succeeds or fails.