RESTful Databases are finally here
Conceptual, Design, Rails, Web 2.0 June 11th, 2008The modern, SQL-driven relational databases arrived in the 80’s, before the Web had taken off. When developers started to build web-based applications, these databases were a natural choice for storing persistent data. Object-oriented databases (OODBs) were available, but they were not widely accepted due to performance and scalability issues. Here is the crucial point: relational databases were not chosen because they were a great fit for Web apps, they were chosen because that was the only realistic option available at the time.
With the arrival of Java and other object-oriented languages, the shortcomings of relational databases became more obvious. Developers now had to map their classes to tables in the database. Object-relational mappers like Hibernate made this process less painful, but it remained an awkward solution compared to using a real OODB.
In the last few years RESTful APIs for web services have become popular. Non-RESTful APIs, like those based on SOAP, expose a relatively small set of classes, with each class having many methods. In contrast, RESTful APIs expose a larger set of resources, each of which can be created, read, updated, and deleted. This matches the way HTTP handles resource requests and thus makes deploying and using a RESTful API straightforward.
With REST, developers now had to map resources to objects and then objects to the database. Frameworks like Ruby on Rails do their best to make this dual mapping straightforward, but clearly the divergence of the API model and the database model is growing.
This year some alternate solutions are emerging in the form of document-oriented databases. These databases are schema-less and can thus be mapped more directly to resources. Moreover, some of them provide RESTful interfaces, thus eliminating the mapping layer altogether! Unlike the OODBs of yesteryear, this new crop of databases claims to provide scalability and robustness that rivals the current conventional database offerings.
These are some of the document-oriented databases that are available:
- CouchDB is the only document-oriented database with a truly RESTful API. A database can be distributed to multiple servers via a robust replication mechanism.
- SimpleDB is a scalable database web service provided by Amazon. It has an API that is best described as “quasi-RESTful”, and it integrates with Amazon’s S3 and EC2 services.
- StrokeDB is an embeddable database written in Ruby. It claims to scale well and provides revision tracking.
- ThruDB is built on top of Facebook’s Thrift and uses a conventional relational database for back-end storage. It provides replication, incremental backups, and search.
- RDDB is another database that is written in Ruby. It can store its data in memory, the file system, or S3 via a pluggable storage mechanism.
Perhaps relational databases finally have some competition and it’s about time.
Add Ri to Favorites
Follow us on Twitter
Add Ri on Facebook
See our Stumbles
See our Diggs
Check our bookmarks
June 11th, 2008 at 12:21 pm
I’ve been working with RESTful Rails since Feb (although it’s probably harder to not be RESTful if you’re starting Rails these days), and I’ve haven’t heard anyone else discussing RESTful databases before now - but I like the sound of it.
Justin, do you have a favorite OODB from those listed above, and do you think one of them could become the defacto for a Rails stack? If Amazon Web Services are doing, presumably Google’s App Engine will offer a RESTfulDB service at some point too.
June 12th, 2008 at 2:51 am
Hi,
nice post. I would like to add that IMHO document-oriented databases have been around for a while in the form of Java Content Repositories (see e.g. Apache Jackrabbit). With Apache Sling there is now available a thin RESTful layer on top of JCRs.
(if you are interested see my post here: http://dev.day.com/microsling/content/blogs/main/datafirst.html)
AFAIK the Grails people are working on making Grails run on a JCR backend.
Cheers
Michael
June 12th, 2008 at 10:52 am
Neil, I have not yet developed an application with any of the document-oriented databases, so I cannot choose a favorite. If I were going to switch from a MySQL server, I would look at CouchDb, because it scales well and has the Apache name behind it. To replace an SQLite embedded database in a Rails project, StrokeDb or RDDB might fit the bill.
Google already offers a Datastore API as part of App Engine. It is based on BigTable, their own unique hyper-scalable, non-relational database.