Transaction Model - Comparing the Use of Amazon DynamoDB and Apache HBase for NoSQL

Transaction Model

Unlike RDBMS, NoSQL databases typically have no domain-specific language, such as SQL, to query data. Amazon DynamoDB and Apache HBase provide simple application programming interfaces (APIs) to perform the standard create, read, update, and delete (CRUD) operations.

Amazon DynamoDB Transactions support coordinated, all-or-nothing changes to multiple items both within and across tables. Transactions provide atomicity, consistency, isolation, and durability (ACID) in DynamoDB, helping you to maintain data correctness in your applications. Apache HBase integrates with Apache Phoenix to add cross row and cross table transaction support with full ACID semantics.

Amazon DynamoDB provides atomic item and attribute operations for adding, updating, or deleting data. Further, item-level transactions can specify a condition that must be satisfied before that transaction is fulfilled. For example, you can choose to update an item only if it already has a certain value.

Conditional operations allow you to implement optimistic concurrency control systems on Amazon DynamoDB. For conditional updates, Amazon DynamoDB allows atomic increment and decrement operations on existing scalar values without interfering with other write requests. For more information about conditional operations, see Conditional Writes.

Apache HBase also supports atomic high update rates (the classic read-modify-write) within a single row key, enabling storage for high frequency counters. Unlike Amazon DynamoDB, Apache HBase uses multi-version concurrency control to implement updates. This means that an existing piece of data is not overwritten with a new one; instead, it becomes obsolete when a newer version is added.

Row data access in Apache HBase is atomic and includes any number of columns, but there are no further guarantees or transactional features spanning multiple rows. Similar to Amazon DynamoDB, Apache HBase supports only single-row transactions.

Amazon DynamoDB has an optional feature, DynamoDB Streams, to capture table activity. The data modification events such as add, update, or delete can be captured in near real time, in a time-ordered sequence. If stream is enabled on a DynamoDB table, each event gets recorded as a stream record along with name of the table, event timestamp and other metadata. For more information, see the section on Capturing Table Activity with DynamoDB Streams.

Amazon DynamoDB Streams can be used with AWS Lambda to create trigger-code that executes automatically whenever an event of interest (add, update, delete) appears in a stream. This pattern enables powerful solutions, such as data replication within and across AWS Regions, materialized views of data in DynamoDB tables, data analysis using Amazon Kinesis, notifications via Amazon Simple Notification Service (Amazon SNS) or Amazon Simple Email Service (Amazon SES) and much more. For more information, see DynamoDB Streams and AWS Lambda Triggers.