Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Globally Distributed Modern Apps using Azure Cosmos DB and Azure Functions

Asif Waquar
November 28, 2019

Globally Distributed Modern Apps using Azure Cosmos DB and Azure Functions

In this session we discussed ,how we can develop modern applications using Cosmos DB & Azure Functions. Cosmos DB’s capabilities and Azure Function’s ability to trigger logic in real time without the need to manage any servers.

Asif Waquar

November 28, 2019
Tweet

More Decks by Asif Waquar

Other Decks in Technology

Transcript

  1. Globally Distributed Modern Apps with Azure Cosmos DB & Azure

    Functions Mohammad Asif Waquar @asifwaquar
  2. Agenda Modern Apps ? Use cases of Global Distributed Apps

    with Cosmos DB Data Triggers using Azure Functions Demo Global Replication of Apps Demo SQL API
  3. Order Goods Inventory Ship Goods Print Invoice ✓ Tight Coupling

    ✓ Integration with Other System ✓ CRUD Application Read/Writes Performance ✓ Update Conflicts
  4. Order Goods Inventory Ship Goods Print Invoice Queue Order received

    ✓ Decoupling Event Driven Apps ✓ Auditing ✓ Debugging ✓ Integration
  5. Order Goods Inventory Ship Goods Print Invoice Queue Order received

    ✓ Decoupling Event Driven Apps ✓ Auditing ✓ Debugging ✓ Integration
  6. Order Goods Inventory Ship Goods Print Invoice ✓ Decoupling ✓

    Fault Tolerance ✓ Stability ✓ Auditing Microservices ✓ Easy Update ✓ Versioning
  7. Turnkey global distribution Elastic scale out of storage & throughput

    Comprehensive SLAs Guaranteed low latency at the 99th percentile Five well-defined consistency models Azure Cosmos DB A globally distributed, massively scalable, multi-model database service
  8. Turnkey global distribution Elastic scale out of storage & throughput

    Comprehensive SLAs Guaranteed low latency at the 99th percentile Five well-defined consistency models Azure Cosmos DB A globally distributed, massively scalable, multi-model database service Column-family Document Graph Key-value
  9. Column-family Document Graph Turnkey global distribution Elastic scale out of

    storage & throughput Comprehensive SLAs Guaranteed low latency at the 99th percentile Five well-defined consistency models TableAPI Key-value Cosmos DB’s API for MongoDB Azure Cosmos DB A globally distributed, massively scalable, multi-model database service
  10. Features • Multi-model data paradigm: key-value, document, graph, family of

    columns; • Low latency for 99% of queries: less than 10 ms for read operations and less than 15 ms for (indexed) write operations; • Designed for high throughput; • Ensures availability, consistency of data, delay at SLA level of 99.999%; • Configurable throughput; • Automatic replication (master-slave); • Automatic data indexing; • Configurable levels of consistency of data. Five different levels (Strong, Bounded Staleness, Session, Consistent Prefix, Eventual);
  11. Account Database Database Database Database Database Container Database Database Item

    Document Vertices/Edges Row Collection Graph Table Item Representations
  12. Account Database Database Database Database Database Container Database Database Item

    Conflict Stored procedure Trigger UDF Container-Level Resources
  13. Data Modelling: Relational vs. Document UserID Name Dob 1 John

    Smith 8/30/1964 StockID UserID Qty Symbol 1 1 100 MSFT 2 1 75 WMT Document { "id": 1, "name": "John Smith", "dob": "1964-30-08", "holdings": [ { "qty": 100, "symbol": "MSFT" }, { "qty": 75, "symbol": "WMT" } ] } User Table Holdings Table Relational Store Document Store Rows Documents Columns Properties Strongly-typed schemas Schema-free Highly normalized Typically denormalized
  14. How do you ensure consistent reads across replicas? - Define

    a consistency level Replication within aregion - Data moves extremely fast (typically, within1ms) between neighboring racks Global replication - Ittakeshundreds of milliseconds to move data across continents Strongerconsistency Higherlatency Loweravailability Weakerconsistency Lower latency Higher availability Replication and Consistency
  15. Logical partition: Stores all data associated with the same partition

    key value Physical partition: Fixed amount of reserved SSD-backed storage + compute. Cosmos DB distributes logical partitions among a smaller number of physical partitions. From your perspective: define 1 partition key per container Partitioning
  16. ❑ Triggering a notification or a call to an API,

    when an item is inserted or updated. ❑ Real-time stream processing for IoT or real-time analytics processing on operational data. ❑ Additional data movement by either synchronizing with a cache or a search engine or a data warehouse or archiving data to cold storage.
  17. 1.

  18. Customer Checkout Jet.Com Microservices Item Added Cart Created Item Added

    Cart Checkout Inventory Shipping Customer Input Binding DB Trigger Output Binding
  19. Important Links https://azure.microsoft.com/en-us/pricing/calculator/?service=cosmos-db#cosmos-db7aed2059-b457-48cc- a0e9-6744ce81096b Pricing Calculator https://docs.microsoft.com/en-us/azure/cosmos-db/sql-query-getting-started Azure Cosmos Emulator

    https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#controlling-the-emulator SQL API Query http://www.microsoft.com/en-us/download/details.aspx?id=46436 Data Migration Tool