What Are ‘Real-Time’ Databases?

Firebase Realtime Database
Firebase Realtime Database. Source: Firebase

Databases in one form or another have been around since the 60’s. What started out as a research project at IBM is now the foundation of nearly every software application in existence. Databases have grown to become an essential tool for software developers, and the concept of a database will be around for many years to come.

There are dozens of different database systems in use today, but one model is particularly interesting – the ‘real-time’ database system. Imagine if you were building a messaging application. The messages would need to be stored in a database, and there would be several clients (instances of the software being used by a user) reading the messages. When a user posts a message to the thread, it would be ideal if all of the other clients saw the new message instantly. There are a few ways of doing that, most of them are hard to implement and kinda messy. One way is to make a call to the database every 5 seconds to fetch the new message. The downside of this is an average 2.5 second delay, and a lot of HTTP calls made to your server. If you had a million concurrent connections, that would be around 200,000 HTTP calls to your server every single second.

Real-time databases on the other hand synchronize the data between clients in…you guessed it…real-time. Firebase Database is an example of a real-time web-hosted NoSQL database. Data is stored as a JSON object and is synchronized across all the application clients in milliseconds. With a real-time database like Firebase, a messaging application could post messages to the database, and, using web sockets, the message would be pushed to all of the clients in about 200 to 800 milliseconds with my testing.

There are only a handful of reputable real-time database options. The most prominent (not in any order) are Firebase Database, RethinkDB, MemSQL, PipelineDB and Apache Kafka. All of them are pretty different and serve different purposes, but they all function similarly in that they allow you to read and write data in near real-time.

These systems are gaining popularity lately because of an increased demand for complicated software applications that need to move or stream data very fast. Not all applications will benefit from a real-time database; and there are some downsides to using a real-time database. So when choosing a database system, stick with the traditional systems unless you know for sure that you can benefit from the capability of a real-time system.

To learn more:

Firebase Database: https://firebase.google.com/
RethinkDB: https://www.rethinkdb.com/
MemSQL: http://www.memsql.com/product/

Be the first to comment

Leave a Reply