Developers often stumble when choosing a NoSQL database on Azure to store a large amount of data in high volumes. Azure Table Storage and MongoDB are often the prime choice for developers. But based on different capabilities and supported environments, it’s difficult to say whether MongoDB or Azure Table Storage will provide better performance and scalability when deployed on a worker role.
This article will provide a brief overview of the capabilities and a simple comparison to help you draw a clear line between both.
Azure Table Storage is simple, fast and carries no maintenance. However, it is more difficult to query do to its specific key structures and lack of secondary indexes. Azure Table Storage is primarily designed to be;
In Azure Table Storage a row is located by partition key + row key, delivering very fast lookup. All Table Storage access is via a well-defined REST API that can be used/integrated with any language. It has SDKs, built on top of the REST APIs, for .NET, PHP, Java, Python & Ruby and more.
MongoDB is primarily a document-oriented database. It runs nicely in Azure with plenty of querying capabilities but requires maintaining several redundant instances to be reliable.
To run it on Azure Service Platform, you need to install MongoDB onto a web/worker roles or Virtual Machine, point it to a cloud drive (Azure Blob) or to an attached disk (for Windows/Linux Virtual Machines). As an add on, you will need to turn on Journaling and define an external endpoint for accessing it. Using the storage from Azure Blob, MongoDB delivers the same redundancy and geo-replication as Azure Table Storage.
When comparing the two, Azure Table Storage is Storage-as-a-Service that is entirely managed by Microsoft. But with MongoDB, all the maintenance and upgrade of database is the responsibility of end user. But in both cases, you are still accessing storage from Azure Storage System.
Azure Table Storage being native and simpler, consumes lesser cloud resources (storage, compute, bandwidth) as compare to MongoDB. On the other hand, MongoDB uses lots of memory for its own cache. Therefore, high scale system with higher number of queries is deployed on larger and powerful instances.
Lastly, if your queries are simple, it would be wise to do a cost comparison (# transactions, Storage, Cost of hosting Mongo on Azure). For simpler environments Azure Table Storage will be better but MongoDB leads out when it comes to more elaborative queries.