Skip to main content

Azure SQL vs Cosmos db

Global Databases: Azure SQL vs Cosmos db


Cosmos DB is a fully managed, multi-model and globally distributed database  that offers the following capabilities:
  • Capable to store relational data, semi-structured data(supports document, key-value, graph, and columnar data models)
  • Fast, single-digit-millisecond data access using popular API including SQL, MongoDB, Cassandra, Tables, or Gremlin(graph).
  • Data is completely transparently encrypted and secure by default
  • Azure Cosmos DB natively partitions your data for high availability and scalability. Azure Cosmos DB offers 99.99% guarantees for availability, throughput, low latency, and consistency on all single-region accounts and all multi-region accounts with relaxed consistency, and 99.999% read availability on all multi-region database accounts for both reads and writes.
  • Azure Cosmos DB is ISO, FedRAMP, EU, HIPAA, and PCI compliant

Geo-replication

While creating Cosmos DB account multi-region, we can choose from the following modes:

Multi-region accounts with multiple write regions.

In this mode, all copies of the database are writable at all times. If a region fails, no failover is necessary.

Multi-region accounts with a single write region.

In this mode, only the primary region contains writable databases. The data replicated to the secondary regions are read-only. You can select enable automatic failover (by default disabled) so that Cosmos DB automatically fails over the primary, writable copy of the database to another region.



In Cosmos DB, data replication is synchronous. When a change is applied, the transaction is not considered complete until replicated across the replicas. Then an acknowledgment is sent to the client. When a failure occurs, no recent changes are lost because replication has already occurred.

Common Azure Cosmos DB Use Cases

  • IoT and telematics
  • Retail and marketing
  • Gaming
  • Social Applications
  • Personalization

Cosmos Db Pricing

Azure Cosmos DB bills for provisioned throughput and consumed storage by the hour. Visit here for the latest pricing here

Azure SQL Database

Azure SQL Database is a relational database-as-a-service (DBaaS)  and PaaS based on the latest stable version of Microsoft SQL Server with following deployment models like Single database, Elastic pools, Managed instance, Instance pools. We can use either:
  • Active geo-replication
  • Auto failover groups

Active Geo-replication

  • Azure SQL Database can automatically replicate a database and all its changes from one database to replicas with the active geo-replication feature. 
  • Only the primary server hosts a writable copy of the database, up to four other logical servers can be created that host read-only copies of the database.
  • Managed instances of Azure SQL Database do not support Active geo-replication.
  • Developers can write code that calls the failover method in the Azure SQL Database REST API.

Auto Failover Groups

An auto-failover group is a group of databases where data replicates automatically from a primary to underlying secondary servers. The data replication method is the same as active geo-replication. However, You can automate the response to a failure by defining a policy.
The replication uses the asynchronous method for the data replication for both active geo-replication and auto-failover groups. An acknowledgment is sent to the client when a change is applied to the primary replica. At this point, the transaction is considered complete, and replication occurs. If a failure occurs, the latest changes made in the primary database may not have replicated to the secondary. Keep in mind that, after a disaster, the most recent database changes may have been lost.

SQL Service Tier and SLA

Please visit MSDN for the latest SLA and pricing data

Bonus Tips:

If a failure occurs,
  • Azure Cosmos Db: No recent changes/data are lost because replication has already occurred
  • Azure SQL database: keep in mind that, after a disaster, the most recent database changes may have been lost


Comments

Post a Comment

Popular posts from this blog

How to Make a Custom URL Shortener Using C# and .Net Core 3.1

C# and .Net Core 3.1:  Make a Custom URL Shortener Since a Random URL needs to be random and the intent is to generate short URLs that do not span more than 7 - 15 characters, the real thing is to make these short URLs random in real life too and not just a string that is used in the URLs Here is a simple clean approach to develop custom solutions Prerequisite:  Following are used in the demo.  VS CODE/VISUAL STUDIO 2019 or any Create one .Net Core Console Applications Install-Package Microsoft.AspNetCore -Version 2.2.0 Add a class file named ShortLink.cs and put this code: here we are creating two extension methods. public   static   class   ShortLink {      public   static   string   GetUrlChunk ( this   long   key ) =>            WebEncoders . Base64UrlEncode ( BitConverter . GetBytes ( key ));      public   static   long   GetK...

Azure key vault with .net framework 4.8

Azure Key Vault  With .Net Framework 4.8 I was asked to migrate asp.net MVC 5 web application to Azure and I were looking for the key vault integrations and access all the secrete out from there. Azure Key Vault Config Builder Configuration builders for ASP.NET  are new in .NET Framework >=4.7.1 and .NET Core >=2.0 and allow for pulling settings from one or many sources. Config builders support a number of different sources like user secrets, environment variables and Azure Key Vault and also you can create your own config builder, to pull in configuration from your own configuration management system. Here I am going to demo Key Vault integrations with Asp.net MVC(download .net framework 4.8). You will find that it's magical, without code, changes how your app can read secretes from the key vault. Just you have to do the few configurations in your web config file. Prerequisite: Following resource are required to run/complete this demo · ...

AWS FREE ASP.NET CORE (.NET 6.0) HOSTING WITH FREE SSL

  FREE ASP.NET CORE (.NET 6.0) Hosting on AWS (Amazon Web Services) Today I was able to host my asp.net 6.0  + ANGULAR 14 application  on AWS Free  Initial Setup of your AWS Account and your Computer Get ready with your asp.net core 3.1 /.net 6 application Install  "AWS toolkit for visual studio 2022" as  visual studio extensions :  it will be required to deploy smoothly from Visual Studio 2022 itself, your life will be easy. Let's finish the AWS account setup  Get signed up with: its free but it will be required a valid credit card or debit card, they will charge nothing for the free services for 1 year * https://portal.aws.amazon.com/billing/signup#/start/email AWS console  for services and offering http://console.aws.amazon.com/ Create a user in AWS Console:  IAM With the help of AWS Identity and Access Management (IAM), you can control who or what has access to the services and resources offered by AWS, centrally manage fine-grained...