Drupal: The Case for NoSQL

image

It isn't an Edward Snowden NSA leak that the overwhelming Drupal population is running on the thirty-year- old and time honored conventional relational database management system (namely MySQL); or, to a lesser extent, on the more progressive object-relational database management system (namely PostgreSQL).  MySQL seems to be the embraced database because the contributed modules populous on d.org were designed with MySQL as the target database. Therefore, just work better with Drupal and cause less heartache for Drupal site builders and admins.  Nevertheless, if your site isn't relying on an extended array of contributed modules, or if the prerequisite modules for your site play nicely with PostgreSQL, then definitely consider an object-relational database model as a strong candidate for your data storage.  This comprehensive comparison benchmark indicates that PostgreSQL is a heavy contender in the Drupal world.  The benchmark gathered metrics while comparing PostgreSQL 9.1 with MySQL 5.6 on Drupal 7.x and it clearly demonstrates that if your site uses the Views module (and most Drupal sites are using it) and if those views are multifaceted (thus generating complex SQL statements) on a large set of nodes, and the moment your queries and data structures become complex, then you might be better off on PostgreSQL.  Reason being, the PostgreSQL join algorithms, optimizer and SQL execution plan completely overpower MySQL’s as the former’s execution engine are just tenfold smarter (sorry MySQL)  But, as the blog title alludes, I am not here to thrash MySQL in favor of PostgreSQL and convince you to choose an object-relational database versus a relational one; instead I am exploring a third option, the new kid on the block: the NoSQL MongoDB

The word “Mongo” was derived from humongous and it is a NoSQL open-source document-oriented database and its throughput is significantly superior to traditional SQL databases for reads and writes.  The curve towards using a NoSQL database becomes practical when the nature of the Drupal site lends itself to heavy traffic and massive data volume of different types.  Examiner.com is the example: a giant online news site that serves content for hundreds of local cities in the United States and is powered by Drupal 7 and MongoDB.  Its hits and visits volume is nontrivial (probably among the most trafficked Drupal sites) and serves a significant and dynamic volume of data in different formats for different specialty topics.

MongoDB l isn't natively supported on Drupal 7, so the integration between the two technologies is achieved through a set of modules.


That means you still need a MySQL database running in parallel with MongoDB where the function of the former is to store users, security, and the nodes whereas the latter for actual entity-field content storage.  These modules are here and, not surprisingly, the Examiner.com folks were the original developers.

I think it took the Examiner folks some guts to embrace MongoDB especially that the two databases are not running in sylos but instead need to be in synch and if, for instance, the MongoDB goes offline while MySQL is operational then inconsistencies may arise especially that MySQL is transactional while MongoDB isn't.  But come Drupal 8, there will be no need to run MySQL in parallel as MongoDB will be natively supported.  That is a major breakthrough.  I am gonna wait for Drupal 8, especially that it is slated to come to a theater near you very soon, before I pull the gun and adopt MongoDB with Drupal.  It is just the idea of running two database technologies in parallel and keeping them in synch seems daunting to me and requires some overhead to ensure consistency.

But don’t get me wrong, I think the underlying database technology for robust Content Management Systems (CMS) will be NoSQL databases and I think MongoDB is a great technology and it is time to slowly move away from the thirty-year-old conventional SQL database technology and embrace newer technologies. So I am inclined to believe that the future will be brighter with Drupal 8 and MongoDB.

Subscribe to Our Newsletter

Stay In Touch