Cosmos DB Consulting

The evolution of database technologies has been exceptional. Right from the first pre-stage flat-file systems to relational and object-relational databases to NoSQL databases, database technology has gone through several generations and its history has spread over more than 50 years now. A time has come when database technology has taken the next step forward to become more scalable, globally distributed and multi-model. Welcome to the new world of Cosmos DB!

If you are looking for better ways to scale your database or want to solve latency issues, overcome complex multi data-centre configurations or if you want your database to be extremely fast, Cosmos DB is the way to go. At Fellow IT, we have technical professionals with expertise gained all over the world and in all fields of the tech industry and we put this expertise to work for you.

What is Cosmos DB?

Cosmos DB is a globally distributed, multi-model NoSQL database service that provides strong consistency, extremely low latency, high availability, throughput and up to 5 consistency levels backed by solid service level agreements (SLAs). The core idea behind building such a database technology was to make it horizontally scalable and globally distributed. This means that your data gets much closer to your customers as it is replicated and stored across multiple Azure data centers in various regions. Cosmos DB guarantees less than 10ms for reads and less than 15 ms latency for writes. Note that, all reads and writes are served from a local region, and then replicated according to the selected consistency model.

Now that we have an overview of what Cosmos DB is, let’s tap into some of its core features and benefits.

Benefits & Core Features

  • Globally Distributed: Whenever you hear about Cosmos DB, you will always hear this term “Globally Distributed.” What it really means is that once you create an Cosmos DB database account, you will be able to replicate your database across multiple Azure centers. More replication means, the database gets much closer to your customers. Currently Azure has a global footprint across 30+ geographical regions and is continuously expanding. Note that you can easily add or remove Azure regions at any point in time.
  • Reduced Latency: As your database is replicated across multiple azure regions, the issue of latency is reduced. Cosmos DB guarantees less than 10ms for reads and less than 15 ms latency for writes. Within 15 milliseconds timeframe, the data is actually written, committed, replicated and indexed. Note that all reads and writes are served from a local region and then replicated according to the selected consistency model.
  • Multi-Model Database: Cosmos DB is a turnkey product that supports multiple database engines. The term multi-model means that data can be stored as key-value pairs, documents, column-family or graphs. The default type system supported by Cosmos DB is called Atom Record Sequence System (ARS System). This means that the data either gets stored as an Atom or Record or Sequence. Data that is stored as an atom is of primitive type (int, bool, float), a record is basically a “Struct” whereas sequence is an “Array” of atom or record.
  • Multi-API Support: Since Cosmos DB provides support for multiple database engines (multiple-models), it also exposes multiple APIs that make the developer’s life simpler. Currently, it provides API support including SQL, JavaScript, Gremlin, MongoDB, Apache Cassandra and Azure Table Storage.
  • Cosmos DB provide a wide variety of data consistency levels.
    • Strong Consistency: This is an RDBMS like consistency. With every request, the client is always guaranteed to read the latest acknowledge write; however, this is the slow and in order to use this the Cosmos DB account cannot be associated with more than one region.
    • Bounded Staleness: This level guarantees that the reads may lag behind by at most x versions of the document or a certain time interval by the client. For example, if the client sets x=2, the user will be guaranteed to get a document no later than the last two versions. It is the same with time. If the time is set to five seconds, every five seconds the resource will be guaranteed to have been written to all replicas to make sure that subsequent requests can see the latest version.
    • Session: This is the most popular of all, and as the name suggests, is scoped to a client session. Imagine someone added a comment on a product on an eCommerce website. The user who commented should be able to see it; however, it will take some time before other users on the website can see it too.
    • Eventual: As the name suggests, the replicas will eventually converge in absence of any additional writes. This happens to be the one with the weakest read consistency, but the fastest of all options.
    • Consistent Prefix: This option, ensures that your sequence of writes is always reflected during subsequent reads. Reads never see out of order writes. Provides good performance and excellent availability.
  • Automatic Failover: Cosmos DB supports both automatic and manual failover. In case of a disaster where an Azure region is not available, any requests to the database are pushed to the next available region. It also allows you to set priorities to regions where you have replicated your database. These priorities, help in redirecting user requests to high priority regions first in case of fail-overs.

Cosmos DB vs AWS DynamoDB vs Google Cloud Spanner

 Cosmos DBAWS DynamoDBGoogle Cloud Spanner
Global DistributionYes (across any Azure Region)NoNo
Horizontal ScalabilityYes (across any Azure Region)NoNo
Multiple APIsYesYesNo
Low LatencyYes, at 99th percentileNoNo
Schema ManagementSchema Agnostic (No Management Required)Index Management RequiredSchema & Index Management Required
Multi-ModelYesNoNo
Automatic IndexingYesNoNo
Consistency Levels5 different levels available2 levels availableOnly 1 available
Comprehensive SLAsYesNoNo

How can Fellow help you with Cosmos DB Consulting?

We have helped our clients with high performance as well as high scalability. We have worked on projects where Cosmos DB has delivered incredible results with write queries as low as 11ms and with read queries as low as 8ms.