Timesten - Commit

> Database > (TimesTen|TT) (In-Memory Database|IMDB)

1 - About

TimesTen supports two kinds of commit:

Type Default Connection att
DurableCommits
Avantage Disavantage
Delayed durability Yes 0 High performance Small possibility of data loss
Immediate durability - 1 Low Performance No data loss

The type of commit used is controlled:

  • on a database scope by a connection attribute called DurableCommits
  • on a transaction scope with the built in procedure ttDurableCommit.

The choice of commit mode has no impact on query performance, they always execute at full in-memory speed.

3 - Type

3.1 - Delayed durability

This commit initially occurs only in memory and the log records for the change are posted to the in memory log buffer.

A background flusher thread will then write batches of changes to the log on disk.

Once the log records have reached disk the changes made by the transaction become fully persistent and recoverable.

In a typical configuration the delay involved between commit and full persistence is normally of the order of milliseconds but it can be more and it is variable; no specific time can be guaranteed.

The advantage of non-durable commit is that it delivers very high write performance; tens or hundreds of thousands of TPS (Transaction per Second) on commodity hardware.

The disadvantage is that there is a (small) window of vulnerability to data loss if there is some kind of system failure.

Advertising

3.2 - Immediate durability

With a immediate durable commit, the commit operation forces an immediate, synchronous flush of all not yet flushed records from the transaction log buffer to disk.

Only when the O/S acknowledges that the records have been fully written to the disk storage media does the commit return success.

The advantage of durable commit is that it provides 100% assurance (as long as the disk storage medium does not fail - but you should use RAID to guard against that).

The disadvantage is that write performance is limited by the performance of the underlying storage and so typical TPS rates are much lower.

4 - Which one to choose ?

You can balance the conflicting demands of performance and durability using the built in procedure ttDurableCommit to choose on transaction basis the type of commit.

TimesTen supports also very high performance data replication and offers a fully synchronous mode (RETURN TWOSAFE). This provides 100% assurance by using dual memory commit across two machines and in most configurations provides significantly better performance than durable commit to disk.

The choice of commit mode has no impact on query performance, they always execute at full in-memory speed.

5 - Documentation / Reference