Cosmos DB for the Data Professional MN PASS User …€¦ · Cosmos DB and SQL Server Consistency...

15
Steve Hughes Principal Consultant 4/17/2018 Cosmos DB for the Data Professional MN PASS User Group

Transcript of Cosmos DB for the Data Professional MN PASS User …€¦ · Cosmos DB and SQL Server Consistency...

Steve Hughes

Principal Consultant

4/17/2018

Cosmos DB for the Data Professional

MN PASS User Group

• We are faster…• Our business accelerators are designed to provide

business value with defined business needs and success criteria in under eight weeks… not just a technology deployment.

• What makes us better…• Total Team Support

• Knowledge Transfer

• Continuous value after the project

• Microsoft Funding Potential*

The PWC Difference…

Source: Microsoft.com

Multi-Model Database Service

• Document database (JSON)• Document DB (SQL)

• Mongo DB

• Graph database• Gremlin

• Key Value Pair• Azure Table

• Wide Column (Column-family)• Cassandra

• Choose API when created• Portal and database optimized for

that API

• Use other APIs to query the data if needed • Not locked in, data stored in

similar fashions

Turnkey Global Distribution

• Click to distribute

• Failover patterns• Automatic, standard

• Manual• As needed

• “Follow the sun”

• Single write node, multiple read nodes

Scale and Throughput

• Throughput• Request Units (RU)

• Covers CPU, memory, IOPs

• Reserved capacity by the second• You reserve it, you buy it

• Cosmos DB Capacity Planner

• Throttled when over capacity/second

• RUs are provisioned for each region• RUs are not shared

• Baseline: 1 KB Read = 1 RU

• Scaling with partitions• Partition key – highly granular

• Logical key only

• More distinct values are better

• 10 GB max on a logical partition

• Partitions managed automatically

• Distributed with storage and throughput• Key must support distributed writes

• Key must support distributed reads• Query filters

Estimating Throughput Demo

• https://www.documentdb.com/capacityplanner

Data Consistency Source: Microsoft.com

Consistency Level Guarantees

Strong Reads are guaranteed to return the most recent version of an item.

Bounded Staleness

Consistent Prefix. Reads lag behind writes by k prefixes or t interval

Session Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-reads

Consistent Prefix Updates returned are some prefix of all the updates, with no gaps

Eventual Out of order reads

Cosmos DB and SQL Server ConsistencyDocument DB vs Relational DB

Consistency Level Guarantees

Strong Reads are guaranteed to return the most recent version of an item.

Bounded Staleness

Consistent Prefix. Reads lag behind writes by k prefixes or t interval

Session Consistent Prefix. Monotonic reads, monotonic writes, read-your-writes, write-follows-reads

Consistent Prefix

Updates returned are some prefix of all the updates, with no gaps

Eventual Out of order reads

Isolation level Dirty readNonrepeatable read

Phantom

Read uncommitted

Yes Yes Yes

Read committed

No Yes Yes

Repeatable read

No No Yes

Snapshot No No No

Serializable No No No

Security

• Data encrypted at rest by default

• Data encrypted in transit• HTTPS/TLS

• AAD authentication supported for RBAC

This Photo by Unknown Author is licensed under CC BY-NC-ND

SLAs

• True differentiator for Cosmos DB

• SLAs cover nearly everything• Latency 99.99% of P99 Latency Attainment (based on hours over guarantee)

• Guarantee: reads under 10ms, writes under 15 ms

• Availability• All up - 99.99% by month

• Read – 99.999% by month

• Throughput – 99.99% based on reserved RUs (number of failures to meet reserved amount)

• Consistency – 99.99% based on setting

This Photo by Unknown Author is licensed under CC BY-SA

Globally Distributing Your DataCosmos DB vs SQL Database

Cosmos DB

• Globally distributed by default• Primary for write

• Push button to activate new secondaries

• Manual failover lets transactions complete thus no data loss (allows for “follow the sun”)

• One URL is used for Cosmos DB, Cosmos DB manages read traffic

Azure SQL Database

• Active Global Replication• 4 Readonly secondaries

• Chain secondaries to increase globalization

• Manual failover may result in data loss due to asynchronous replication

• Need to plan for IP address changes, use Traffic Manager

• Settings: Replicate data globally

• Settings: Default consistency

• Data Explorer• Collections

• Documents

• Scale & Settings

• Metrics

Exploring Cosmos DB

Wrapping up with …Polyglot Data Solutions

• Modern applications will require multiple data solutions

• Cosmos DB and Azure SQL Database (SQL Server, MySQL, PostgresSQL) can be used by the same application to meet specific needs

• Data professionals need to understand data is key to applications and how that data is stored and access is constantly changing

• One database does not rule the world

• Think integration points, e.g. JSON stored natively in SQL Server