An Introduction to Azure CosmosDb

Next up on my Azure walkthroughs is CosmosDb. This one can be pretty exciting when you talk about its potential as in a nutshell it is a NoSQL database that is massively scalable with low latency and a focus on integrations for modern web and mobile applications.

It’s an Azure solution that you can set up through the portal and then either using the interface or programmatically through a coding interface. This blog will talk about what CosmosDb is and the high-level concepts and then going in-depth into the demos in later blogs.

 

What is NoSQL?

So first up, in order to really get the idea behind CosmosDb, I had to begin to understand NoSQL. For me, NoSQL was confusing because I was expecting some kind of super easy syntax for interacting with a database in a traditional way. In reality, a NoSQL database is a bit of a misnomer because you can still interact with it using a type of SQL and its real differences are completely unrelated.

Speaking of which, unrelated is what NoSQL is all about. NoSQL databases are NOT relational like a current database. They are constructed with big data in mind and as such, CosmosDb are

  • built schemaless – to enable changes to enterprise-grade solutions without the headaches
  • built for low latency to ensure high availability and consistency
  • built for distribution with replication and geolocation to match your needs
  • utilising horizontal partitions – enabling virtually limitless storage and throughput

Ultimately, it is a virtually unlimited database with automatic scaling and replication. Simply define your performance level and Cosmosdb spins up more resources to deal with the demand.

How did we get to CosmosDb?

CosmosDb is actually an evolution of several Microsoft products. It actually started way back in 2010 as ‘Project Florence’ as an acknowledgement of the problems massive applications face when dealing with big data. It built on many early concepts and was made available to the general developer in 2015 and finally evolved into CosmosDb as we know it today in late 2017.

 

How do you work with CosmosDb?

So the cool thing about CosmosDb is that you can work with it pretty much however you want. At the time of writing (October 2017) the following APIs and sotrage methods are supported.

  • Document types, using SQL API (JSON) or MongoDb API (BSON)
  •  

    Table API (Replaces the exsiting Azure Table Storage)

  •  

    Graph API (Using graph traversal Language (Gremlin))

  •  

    Columnar (Cassandra API uses explicit schema)

  •  

    Additional APIs are planned!

     

These API project your data model but ultimately ComosDb uses Atom Record Sequence (ARS) that uses a KVP model to work. You don’t need to know how it works underneath the surface though, so just focus on your APIs. The good thing about CosmosDb is that it ultimately translates your preferred method and allows you to interact with it however you want. This makes it super accessible regardless of your previous experience and really resonates with Microsoft’s ongoing commitment to open source and inclusive development.

 

Summary

So why use CosmosDb over a relational database? If your application utilises big data and need volume, variety and velocity on a global scale, Azure will take care of a huge amount of this work for you. Yes, you could create an Infrastructure solution to emulate it. Realistically though, if you are here you are likely trying to work with it rather than create it. Demos’ will be linked below when created, so come back to learn more!

 

Demos

Demo: Setting up a CosmosDb account in Azure

Demo: Working with CosmosDb locally

Demo: Working with CosmosDb SDK

 

 

 

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s