The NoSQL movement is fighting the database establishment with relational database management system (RDBMS) alternatives. The surprising aspect of this movement is Microsoft’s recognition and decision to embrace the RavenDB offering. We take a closer look at RavenDB.
Who needs a schema?
The NoSQL initiative developed out of necessity, because Google, Amazon, and other companies needed alternative ways to deal with vast amounts of data. The result is key-value stores such as BigTable or document storage such as CouchDB. Cloud storage solutions offer non-traditional (AKA non-RDBMS) storage as well with Window Azure Table Storage (based on key-value pairs) and Amazon’s EC2 (based on Hadoop). The basic theme of these systems is speed and scalability, which isn’t always an option with traditional database systems.
The basic underpinning of a relational database system like SQL Server or Oracle is the idea that data is stored in rows and columns that lead to a fixed schema. The growth of the Web and so-called big data has introduced areas where schema-based data is not the best approach.
While many predict the slow demise of RDBMS, I am not sold on that fact. However, I do realize that different situations require different tools, and I see a bright future of unstructured data storage as the amount and types of data available continue to grow. While this began an open source movement, Microsoft has fully embraced it with the Raven DB.
Never more
RavenDB is a document database designed for the .NET/Windows platform. It comes with everything you need to get started with non-relational data in your .NET application. Data is stored as schema-less JSON. There are a couple of ways to interact with this data: directly via HTTP and a RESTful API or via the more convenient .NET Client API. The .NET Client API uses LINQ-style syntax for working with the RavenDB document store.
Simple installation
You need to set up and install .NET Framework 4.0 before installing Raven DB. Then you download the latest version of RavenDB, which is available in a zip file that is extracted to a directory on your server. The included readme file contains additional setup information, but there are three ways you can utilize Raven DB: Windows Service, IIS application, or embedded in a .NET application.
The latest installation package includes these directories:
- Client: Lightweight client for use with .NET 4.0.
- Client-3.5: Lightweight client for use with .NET 3.5.
- Silverlight: Silverlight 4.0 client.
- EmbeddedClient: Files necessary for using RavenDB in embedded mode.
- Server: Files required to use RavenDB in server mode.
- Web: Files required to use RavenDB under IIS.
- Bundles: Files for extending RavenDB in various ways.
- Samples: Sample RavenDB applications to get you started.
Using the server
An easy way to get a feel for RavenDB and how it works with data is using the server mode. The following command is used to set up the server.
<Raven root directory>\Server\Raven.Server.exe /install
Once it is installed, the RavenDB UI is accessed via this URL on the server where it is installed: http://localhost:8080/raven/studio.html. Figure A shows the UI opened for the first time. The interface uses Silverlight, so you may be prompted to upgrade or install necessary Silverlight components.
Figure A
RavenDB management interface (Click the image to enlarge.)
You can click the Create Sample Data button to populate a sample data store to get an idea of how the RavenDB document store works. Figure B shows one of the sample documents opened.
Figure B
Viewing sample RavenDB document store (Click the image to enlarge.)
The data in Figure B (and the following listing) shows how data is stored in RavenDB. It stores album data with the following attributes: AlbumArtUrl, Artist, Genre, Price, Title, and Count Sold.
{"AlbumArtUrl": "/Content/Images/placeholder.gif",
"Artist": {
"Id": "artists/133",
"Name": "Stevie Ray Vaughan & Double Trouble"
},
"Genre": {
"Id": "genres/6",
"Name": "Blues"
},
"Price": 8.99,
"Title": "In Step",
"CountSold": 0
}
The document has an id value, which is shown in Figure B (artists/633), but the artist value itself has an id value (artists/133) since artists can have multiple albums. Also, the genre has an id value (genres/6) since multiple albums are assigned to a genre. This data has a unique URL (http://localhost:8080/raven/studio.html#/edit?id=albums/614&database=Default), and you can access the other items via URL. For example, the genre information can be accessed with this URL: http://localhost:8080/raven/studio.html#/edit?id=genres/6&database=Default. The data can be edited as well as viewed via the Web interface. In the next column, we’ll take a look at using RavenDB within a .NET application.
The future
Many NoSQL pundits predict the downfall of the traditional RDBMS, but each has their own application where the alternative is not appropriate. The RDBMS alternatives seem to have a bright future with heavyweights Google, Amazon, and Microsoft behind the various offerings. RavenDB makes it easy to embrace it now in your .NET applications.
How do you see the future of the database landscape? Are you using a non-traditional database platform? Share your thoughts with the community.