BT

Ready for InfoQ 3.0? Try the new design and let us know what you think!

Microsoft Directly Challenges MongoDB and Cassandra with Cosmos DB

| by Jonathan Allen Follow 655 Followers on Mar 01, 2018. Estimated reading time: 3 minutes |

The phrase "embrace, extend, and extinguish" is often thrown about whenever someone is upset with Microsoft. Superficially it describes any attempt by a technology company to attract users of a competitor's product, but the actual strategy is more complicated than that. In this report we will use Azure Cosmos DB to illustrate the concept.

Embrace

The first step is to embrace the competitor's standards. In the 80s and 90s this meant having the ability to read and write their file formats. For example, MS Word needed to be able to open, modify, and save WordPerfect documents flawlessly. Otherwise users of the then dominant WordPerfect would not even consider trying to use Word.

In the world of NoSQL databases, the standard to be embraced is the API. Unlike relational databases, which at least nominally support the ANSI SQL standard, each NoSQL database has its own set of APIs and matching drivers. So theoretically one is locked into a specific product and cannot switch to any other without a costly rewrite.

Microsoft's Cosmos DB addresses this vendor lock-in by embracing the APIs and drivers that already exist for the more populate databases. And by "embrace" we mean this in a very literal fashion.

When you provision a Cosmos DB instance, you must select an API type. Options include:

  • SQL (actually the old Azure DocumentDB)
  • Gremlin, a graph database
  • MongoDB
  • Azure Table
  • Cassandra

If you choose MongoDB as your API, you can then use the existing MongoDB drivers. Not a driver that looks somewhat like the one for MongoDB. Rather, Microsoft's documentation points you directly to the official MongoDB drivers for Node.js, .NET, Java, etc. Likewise, for Gremlin and Cassandra you are expected to use their respective drivers when communicating with Cosmos DB in Gremlin or Cassandra mode.

In theory this means that Azure Cosmos DB is a drop-in replacement for these other NoSQL databases.

Extend

Given that all of the third-party databases listed above are free/open source, Microsoft has to offer something more than just hosting. Otherwise customers will switch back as soon as someone else offers a compatible cloud solution with better performance and/or lower prices.

This is where Microsoft's other Azure products come into play. Cosmos DB can be integrated with open source products such as Apache Spark or Apache Kafka as well as proprietary products such as Azure Search, Azure Data Factory, and HDInsight. Rather than extending the file format, Microsoft is attempting to extend what you can do with the database.

While switching from MongoDB's cloud hosting to Cosmos DB is mostly a QA and operations question, the use of other Azure products can put significant limitations on your future architectural options. The convenience and capabilities offered today need to be carefully weighed against long term plans.

Extinguish?

It is hard to predict where the NoSQL sector will go in the long run. One possibility is that a standard query language, much like ANSI SQL in the 1980's, will be developed and shared across all major NoSQL databases. Another is that ANSI SQL itself will continue to evolve until it is capable of serving that role.

Or perhaps the existing APIs such as found in MongoDB will become de facto standard, informally agreed upon by major vendors but never formally approved by a standards body.

In the meantime, it is unlikely that any one NoSQL database will stay in a dominant position so long as the competitors can easily copy their REST APIs. Even if CosmoDB manages to unseat MongoDB or Cassandra, another database/cloud vendor such as Amazon or Google can do the same to them.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Cosmos in perspective by Nuri Ha

Cosmos is an Azure DBaaS with several interfaces, making it a compelling offering for some scenarios.
The MongoDB interface however, is not a complete replacement for MongoDB's capabilities. In particular, the aggregation framework is absent. MongoDB's aggregation framework is the rich query syntax that allows one to slice and dice data across single collection (or multiple ones using $lookup and $graphLookup). Without the aggregation support, you can't effectively do much more than filter documents and return a subset of their field. The cross-document syntax is very limited. While this guarantees performance doesn't degrade much, it hardly is sufficient for workloads that require multi-modal use of the data. In other words - great for storing events, and items of arbitrary shape, but not really a full backend database replacement. You would likely have to build out secondary stores as either source or destination for application data, and therefore require more infrastructure, more complexity, and more cost.

CosmosDB is a works well for things like events, IoT measurements, and other such high volume data. Just that you will have to pair it with other system(s) to make use of the data beyond item-by-key or items-by-filter type access. MongoDB offers much richer mechanisms to query, manipulate, and aggregate that data.

CosmosDB offers streaming out of data mutations, making it easy to tack on other microservices or stream analytics workloads. MongoDB 3.6 exposes pretty much similar capability by exposing Change Streams.

Re: Cosmos in perspective by Rob Obdeijn

There is actually a public preview for MongoDB Aggregation support in Cosmos DB:
docs.microsoft.com/en-us/azure/cosmos-db/mongod...

I agree that it is not currently a complete replacement for MongoDB, let alone Cassandra, but Microsoft is making decent progress.

Re: Cosmos in perspective by Nuri Ha

Thanks! I'll take a look.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss
BT