Review: RethinkDB rethinks real-time Web apps

RethinkDB's NoSQL document store delivers high-speed change notifications for super-responsive apps

1 2 Page 2
Page 2 of 2

Using the GUI’s data explorer, you can enter and execute ReQL queries in JavaScript. Enable the query profiler, and you get a JSON document describing the steps the system went through to satisfy the query. This document provides information such as how much time the system spent reading each shard, how much time was spent evaluating the primary index, and so on. You can also browse any RethinkDB database and display data in one of several views. The tree view shows the JSON data in “pretty printed” form, while the raw view spews out the JSON as it is. The table view outputs the data as it might appear if RethinkDB were an RDBMS: Each document is a row, and the document fields become columns in the tabular output.

Responsive JSON database

RethinkDB sports plenty of knobs that you can turn to tune its behavior to meet your application’s needs. While it’s true that RethinkDB is not truly ACID compliant, its durability and consistency are adjustable across a wide range, usually on a per-table basis. For example, if you want speedy writes at the expense of consistency, you can configure write operations to a table to be acknowledged when at least one replica -- rather than a majority -- confirms the write. Similarly, you can select “soft” or “hard” durability. Soft durability acknowledges a write as soon as data is cached in memory, while hard acknowledges the write only after it has been committed to disk.

To improve the responsiveness in large clusters, you can specify that some nodes of a cluster be proxy nodes. A proxy node stores no data, but acts as a request/response router; it knows the optimal route to send a request. In addition, proxy nodes can de-duplicate changefeed messages, alleviating network traffic congestion.

ReQL, though not SQL-like, is nonetheless easy to comprehend. The fact that it is written in any of a number of familiar languages (Python, Ruby, JavaScript) means that most programmers will have no difficulty mastering its component parts.

Embedded query languages occupy a soft spot in my heart for several reasons. They can laugh at injection attacks. They don't demand mental gear-shifts as you move from one language paradigm to another (as when you have to use SQL statements as strings in an object-oriented language). You don't have to fiddle with constructs to move data between the query language's environment and the host language's environment. And you're free to use the host language's expressiveness in your queries.

That's a lot of positives, and ReQL has them all. Perhaps the only negative is that there is no official ReQL driver for Java -- yet. This is somewhat understandable; the preferred languages for RethinkDB developers tend to be DSLs. However, a community-supported driver for Java is available, and the RethinkDB engineers tell me that an official Java driver is in the works. That single blot will soon be erased.

Along with the powerful query language, RethinkDB uniquely combines all of the benefits of a distributed, document-oriented database with the ability to continuously push updated query results to applications. It’s a quick and easy download, and the website’s documentation provides plenty of tutorial information to get started. There’s no reason not to.

At a Glance
  • RethinkDB uniquely combines all of the benefits of a distributed, document-oriented database with the ability to continuously push updated query results to applications that subscribe to changes.

    Pros

    • Support for real-time applications goes beyond polling and synchronization
    • RethinkDB queries include table joins, subqueries, geospatial queries, aggregation, and map-reduce
    • ReQL query language is easy for developers to comprehend
    • ReQL is immune to injection attacks
    • Easy-to-learn JSON-based document model
    • Management and monitoring console “built in”

    Cons

    • ReQL does not optimize queries
    • RethinkDB does not support transactions across multiple documents
    • Server does not run on Windows
    • No official Java client driver

Copyright © 2015 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2