Why NoSQL is Not Just For Google and Amazon
Join the DZone community and get the full member experience.Join For Free
in fact, for over 30 years or so, the database wars have been settled, the relational databases have won the fight, and the decision left was which relational database to use. everyone “knows” that nosql is something that google invented to handle the amount of data and users they have, and that is it somehow related to scaling to google or facebook levels.
and since most of us aren’t working on applications that have millions of users, we get to keep using the tried and true methods, no need to bother with something that is only relevant at extreme high scale. the relational database has served us well, and can continue serving us in the future. learning sql was a very smart investment, after all.
let us go back a bit to those database wars that i mentioned. in the 70s there were actually quite a lot of different types of databases competing with each other, anything from isam to dbase to relational databases. and as you can see, the relational database has won such a decisive victory that it rules undisputed for over a generation.
but one thing that we have to remember is that those database wars were fought on a drastically different ground than the one we have today.
1980 vs. 2012
in 1980, a 10 mb hard disk (that is in mega bytes, about 2 songs or 3 pictures) cost around 4,000 $ us. adjusting for inflation, that comes at about 11,000 $ us in today’s dollars. just to compare, today a 10 mb of disk space would cost you about half a dollar. and those aren’t the only changes, of course. computation speed, memory sizes and networks are all many orders of magnitude faster and cheaper than they were in the 80s.
even more interesting is the differences in the type of applications being built. in the 80s, a typical application had exactly one user. multi users’ applications had to support… 3 users. all of them at the same time! the ui paradigms were drastically different, as well. at the time, the master – details form was the top of the hill, the uncontested king of good ui design. but today… there are usually so many items and active elements on a single web page today as there were in entire applications then.
why the history lesson, you ask? why, to give you some perspective on the design choices that led to the victory of the relational databases. space was at a premium, the interaction between the user and the application closely modeled the physical layout of the data in the database. that made sense , because there really were no other alternatives given the environment that existed at the time.
that environment is no longer here, and the tradeoffs made when 30 mb would cost as much as an annual salary are no longer relevant. in particular, one immensely annoying aspect of relational database is very much a problem today. relational databases trade off read speed in favor of write speed. because it made perfect sense to make this trade off when disk space was so costly, and making users wait an extra second was no big deal.
in separate studies conducted by both google and amazon, they found that even additional 100ms added to the latency of a page severely impacted their bottom line. and yet relational database tradeoff read speed (having to do joins and extra loads) for write speed (having to write small amount of data).
another problem that pops up frequently with relational database is their inability to handle complex data types, such as collections or nested objects. oh, you can certainly map that to a relational database, but that requires additional tables, and each additional table is going to make it that much more complex to query the data, work with it and display it to the user.
for many years, i have been working with customers on optimizing their applications using relational databases, and i’ve seen the same problems occur over and over again. that led me to the belief that the nosql databases aren’t suitable just for extremely scalable scenarios. nosql databases make sense for a wide range of options, and this realization led me to ravendb.
in my company, we are using ravendb as the backend database for everything from a blog, our ordering and purchasing systems, the daily build server and many more.
the major advantages that we found weren’t the ability to scale (although that exists), it is the freedom that it gives us in terms of modeling our data and changing our minds.
Opinions expressed by DZone contributors are their own.