Sikau

Microsoft Azure · Day 7 · about 45 min

Azure SQL and Cosmos DB

Relational or global: consistency levels and partition keys.

Orders from three cities

The momo shop now has branches in Pokhara, Kathmandu and Butwal, and a delivery app used by Nepalis in Doha and Sydney. Should every order live in one SQL database in Central India, or in a database copied to every region where customers are? It depends on what the app can tolerate: a slightly old menu is fine; a payment counted twice is not.

Azure offers both kinds. Today you'll compare them, then model Cosmos DB's famous five consistency levels precisely enough to tell which ones would allow a given read.

Azure SQL

Azure SQL Database is SQL Server run for you: Microsoft patches it, backs it up (with point-in-time restore), and keeps it highly available. You buy it in one of two ways: the DTU model bundles compute, memory and I/O into Basic, Standard and Premium sizes; the vCore model lets you pick cores and storage separately and use your existing SQL Server licences. Serverless pauses when idle and bills per second.

  • Elastic pools share resources between many small databases with spiky loads.
  • Active geo-replication and failover groups keep readable copies in other regions.
  • SQL Managed Instance is nearly 100% SQL Server compatible, for lifting old apps; SQL Server on a VM gives you full control (and full patching).
  • Azure also runs managed PostgreSQL and MySQL.

The rest of this lesson

  • Cosmos DB and its five levelsexplain
  • A gap in the readpredict
  • Strongest to weakestorder
  • Which database?match
  • Model consistency and partitionswrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 10 lessons of Microsoft Azure