the hitchhiker’s guide to the cosmos · @chadgreen. turnkey global distribution. elastic scale...
TRANSCRIPT
@chadgreen@chadgreen
The Hitchhiker ’s
Guide to the Cosmos
Chad GreenA t l a n t a C o d e C a m p
S e p t e m b e r 1 4 , 2 0 1 9
@chadgreen
Platinum Sponsors
@chadgreen
Gold Sponsors
@chadgreen
Special Thanks
@chadgreen@chadgreen
Who is Chad GreenD i r e c t o r o f S o f t w a r e D e v e l o p m e n tS c h o l a r R x
� [email protected] chadgreen.com� ChadGreen� ChadwickEGreen
@chadgreen@chadgreen
What is Cosmos DB
@chadgreen@chadgreen
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
Turnkey global distribution
@chadgreen@chadgreen
Comprehensive SLAs
Turnkey global distribution
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
Turnkey global distribution
@chadgreen@chadgreen
Turnkey global distribution
Elastic scale out of storage & throughput
Comprehensive SLAs
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
Comprehensive SLAs
@chadgreen@chadgreen
Turnkey global distribution
Elastic scale out of storage & throughput
Comprehensive SLAs
Guaranteed low latency at the 99th percentile
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
Elastic scale out of storage & throughput
@chadgreen@chadgreen
Turnkey global distribution
Elastic scale out of storage & throughput
Comprehensive SLAs
Guaranteed low latency at the 99th percentile
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
Guaranteed low latency at the 99th percentile
Five well-defined consistency models
@chadgreen@chadgreen
EventualSessionStrongConsistent PrefixBounded Staleness
Turnkey global distribution
Elastic scale out of storage & throughput
Five well-defined consistency models
Comprehensive SLAs
Guaranteed low latency at the 99th percentile
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
@chadgreen@chadgreen
No schema or index managementBattle tested database serviceUbiquitous regional presenceSecure by default and enterprise ready
Turnkey global distribution
Elastic scale out of storage & throughput
Five well-defined consistency models
Comprehensive SLAs
Guaranteed low latency at the 99th percentile
A globally distributed, massively scalable, multi-model database serviceAzure Cosmos DB
@chadgreen@chadgreen
Azure Cosmos DB Request Units
• Item Size
• Item Indexing
• Item Property Count
• Indexed Properties
• Data Consistency
• Query Patterns
• Script Usage
@chadgreen@chadgreen
Azure Cosmos DB Pricing
Unit PriceProvisioned Throughput (multiple region writes) per 100 RU/s $0.016/hourProvisioned Throughput (single region writes) per 100 RU/s $0.008/hourSSD Storage (per GB) $0.25 GB/month
Starts at approximately $23.61/month
Save 15-65% with Reserved Pricing
@chadgreen@chadgreen
Azure Cosmos Capabilities
What if we have REALY large data requirements?
@chadgreen@chadgreen
Azure Cosmos Capabilities
Resource Default LimitMaximum RUs per container 1,000,000Maximum RUs per database 1,000,000Maximum Rus per (logical) partition key 10,000Maximum storage across all items per (logical) partition key 10 GBMaximum number of distinct (logical) partition keys UnlimitedMaximum storage per container UnlimitedMaximum storage per database Unlimited
@chadgreen@chadgreen
Cosmos Use Cases
@chadgreen@chadgreen
IoT and Telematics
Common Pattern in IoT use cases
• Ingest bursts of data from devices and sensors of various locales
• Process and analyze streaming data to derive real-time insights
• Archive data to cold storage for batch analytics
@chadgreen@chadgreen
IoT and Telematics
@chadgreen@chadgreen
Retail and Marketing
• Used extensively by Microsoft’s own e-commerce platforms
• Storing and querying a set of attributes for entities
• Examples of catalog data
• User Accounts
• Product Catalogs
• IoT Device Registries
@chadgreen@chadgreen
Retail and Marketing
@chadgreen@chadgreen
Retail and Marketing
@chadgreen@chadgreen
Gaming
• Database tier is crucial
• Often require single-millisecond latencies for reads and writes
• Needs to be fast and able to handle massive spikes
@chadgreen@chadgreen
Gaming
@chadgreen@chadgreen
Web & Mobile Applications
• Modeling social interactions
• Integrating with third-party services
• Building rich personalized experiences
@chadgreen@chadgreen
Web & Mobile Applications – Social Applications
@chadgreen@chadgreen
Web & Mobile Applications – Personalization
@chadgreen@chadgreen
Integrations
@chadgreen@chadgreen
Cosmos DB Integrations
Apache SparkEtch APIChange FeedAzure FunctionsAzure Logic AppsMicrosoft Flow
@chadgreen@chadgreen
Navigating the 5 API
Models
@chadgreen@chadgreen
Resource Model and API Projections
AtomResourceSequence
@chadgreen@chadgreen
SQL APID o c u m e n t D a t a b a s e
@chadgreen@chadgreen
SQL API – What
• Document Database
• Originally Microsoft’s DocumentDB implementation
• Supports using SQL as a JSON query language
• Uses JavaScript’s programming model as foundation for query language
@chadgreen@chadgreen
SQL API – Why
Building a new non-relational
document database and want
to query using SQL
@chadgreen@chadgreen
SQL API – How: Data Model
SELECT * FROM cWHERE c.OwnerEmailAddress= ‘[email protected]’
@chadgreen@chadgreen
SQL API – How: Insert
@chadgreen@chadgreen
SQL API – How: Insert
@chadgreen@chadgreen
SQL API – How: Query
@chadgreen@chadgreen
SQL API – Query
• API (using Microsoft.Azure.Cosmos)
• LINQ to SQL API
• JavaScript
• Stored Procedures
• Triggers
• User Defined Functions
• Entity Framework
@chadgreen@chadgreen
MongoDBD o c u m e n t D a t a b a s e
@chadgreen@chadgreen
API for MongoDB – What
• Native MongoDB implementation
• Allows existing client SDKs, drivers, and tools to interact transparently
• Default is Mongo v3.2; v3.4 in preview
@chadgreen@chadgreen
API for MongoDB – Why
Migrating data from a
MongoDB database to Azure
Cosmos DB’s fully managed
service
@chadgreen@chadgreen
API for MongoDB – How: Data Model
Filter: {"OwnerEmailAddress":"[email protected]"}
@chadgreen@chadgreen
API for MongoDB – How: Insert
@chadgreen@chadgreen
API for MongoDB – How: Insert
@chadgreen@chadgreen
API for MongoDB – How: Query
@chadgreen@chadgreen
Gremlin API
G r a p h D a t a b a s e
@chadgreen@chadgreen
Gremlin API – What
• Collection of vertices and edges
• Represents entities as vertices and the ways in which those entities relate
to the world as relationships
• Allows us to model all kinds of scenarios
@chadgreen@chadgreen
Gremlin API – What
@ChadGreen
@AzureCosmosDB@_LBosq
Follows Follows
Follows
Follows
Follows
User
User
User
@chadgreen@chadgreen
Gremlin API – Why
Building a graph database to
model and traverse
relationships among entities
@chadgreen@chadgreen
Gremlin API – Why
• Social Networks
• Search
• Recommendations
• Communication networks
• Identity and access management
• Fraud detection
Represent data as it
is found in nature
@chadgreen@chadgreen
Gremlin API – How: Data Model
g.V().hasLabel(‘presentation’).has(‘ownerEmailAddress’, ‘[email protected]’)
@chadgreen@chadgreen
SQL API – How: Insert
@chadgreen@chadgreen
SQL API – How: Query
"g.V().hasLabel('tag’).has('name’, 'Azure’).in('taggedAs’).hasLabel('presentation')"
@chadgreen@chadgreen
Gremlin API – Query
• API (using Gremlin.Net)
• Community API (Gremlin.Net.CosmosDb)
• JavaScript
• Stored Procedures
• Triggers
• User Defined Functions
• SQL API
@chadgreen@chadgreen
Cassandra API
W i d e C o l u m n S t o r e
@chadgreen@chadgreen
Cassandra API – What
• Open-source, distributed, wide column store, NoSQL database
• Designed to handle large amounts of data
• Uses many commodity servers, providing high availability
• Developed to power the Facebook inbox search feature
@chadgreen@chadgreen
Casandra API – Why
Migrating data from Cassandra
to Azure Cosmos DB
@chadgreen@chadgreen
Cassandra API – How: Data Model
@chadgreen@chadgreen
Cassandra API – How: Insert
@chadgreen@chadgreen
Cassandra API – How: Insert
@chadgreen@chadgreen
Cassandra API – How: Query
@chadgreen@chadgreen
Cassandra API – Query
• API (using CassandraCSharpDriver)
• Cassandra Query Language (CQL)
• Cassandra-based tools (like cqlsh)
@chadgreen@chadgreen
Table APITa b l e S t o r a g e
@chadgreen@chadgreen
Table API – What
• Stores large amounts of structured data
• Ideal for storing structured, non-relational data
@chadgreen@chadgreen
Table API – Why
Migrating data from Azure
Table storage to Cosmos DB
@chadgreen@chadgreen
Table API – How: Data Model
@chadgreen@chadgreen
Table API – How: Insert
@chadgreen@chadgreen
Table API – How: Insert
@chadgreen@chadgreen
Table API – How: Query
@chadgreen@chadgreen
Call to Action
@chadgreen@chadgreen
a z u r e . m i c r o s o f t . c o m / e n - u s / t r y / c o s m o s d b /
@chadgreen@chadgreen
� c h a d g r e e n @ c h a d g r e e n . c o m c h a d g r e e n . c o m� C h a d G r e e n� C h a d w i c k E G r e e n
Thank You