I recently had the opportunity to attend the ALT .NET meeting in New York City and catch the presentation on NoRM and MongoDB by John Zablocki. As someone who was educated and has worked with only relational databases throughout his career it was kind of a mind bending experience. The concept of literally storing data ad-hoc within the “database”, without any real relational model to speak of.
The reasons for this shift in thinking vary, but the main reason is the increased need to support horizontal scaling. Traditionally, we have known vertical scaling, whereby a bigger machine is brought in as needs increase. In today’s computer world where we are starting to see limits on processor speed, this is simply not feasible to large high volume sites such as Amazon, Facebook, Twitter, and Google. Horizontal scaling is based on the principle that you can get better performance by increasing the number of machines hosting the service, even if the individual machines themselves are standard consumer boxes. However, as we begin to leverage this distributed model, the limitations of RDBMS become apparent, hence the need for something different.
Database persons will often talk about ACID with respect to RDBMS as a means for ensuring data consistency. ACID often refers to the transactions within the database: Atomicity, Consistency, Isolation, Durability. But when we start moving into distributed systems this becomes much harder to utilize without compromising performance. In 2000, Eric Brewer introduced the CAP theorem. CAP stands for Consistency, Availability, and Partition Tolerance. It postulates that a database system can ONLY ever provide two of these principles. Most RDBMS system are CP (Consistency, Partition tolerance) systems. MongoDb (and other NoRM systems) is an example of AP systems, or highly available with “eventual” consistency. It means that the MongoDb system does not care about immediate consistency, but that the system will eventually be consistent. This is a rather hard concept to get your head around and I am not here to sell you on the idea; I leave that to members of the NoRM community.
MongoDB is a Document Store type NoRM system, whose databases are comprised of collections (“tables”) which are actually sets of schema-less JSON objects, yes this database stores things in JavaScript. The objects have not set format, they just exist. There are automatically given a unique key (primary key) as a means of identification and can contain references to other “documents”. MongoDB is an example of a Document Store NoRM database.
I am not going to go into a whole in-depth discussion on MongoDB or its technical facts. But it is definitely something worth checking out. I was quite impressed by the concepts being pitched by the NoRM community and how it could be used. The even better news is that drivers do exist to allow .NET integration and use of the LINQ syntax, though be careful as many NoRM systems are built on the Linux platform and can only be used in such an environment. MongoDB, however, is one of the ones that is supported on Windows. I admit, it is a bit strange using JavaScript as the primary means for storage and querying of data, but I am still fascinated and looking forward to checking it out.
Official link to MongoDB project: http://www.mongodb.org/