Presentation is loading. Please wait.

Presentation is loading. Please wait.

Azure DocumentDB: Advanced Features for Large-Scale Apps {

Similar presentations


Presentation on theme: "Azure DocumentDB: Advanced Features for Large-Scale Apps {"— Presentation transcript:

1 Azure DocumentDB: Advanced Features for Large-Scale Apps {
"name": "Andrew Liu", " ": "twitter": }

2 First… a Story

3 Indexing JSON and fighting zombies at SCALE

4 Next Games The Walking Dead TV show
Drama about a zombie walker apocalypse on AMC First cable drama to beat broadcast shows Most watched cable TV show in the US (16M users) Game Development Studio Based in Helsinki, Finland 65 employees Develop F2P mobile games for iOS and Android Based on own & licensed IP

5 The Challenge More Users, More Problems
Scale with expectation of millions of users on Day 1 Deliver real time responsiveness for a lag-free, gaming experience Highly competitive – high scores and global leaderboards critical

6

7 The Results #1 in Apple app store free apps during launch week
>1M downloads ~1B queries per day 99p queries served under 10ms

8 How?

9 Just throw some data in a database!

10 Just throw some data in a database!

11 Not that easy…

12 Why is this such a hard problem?
Caches Scoreboard keeps updating… SQL database Need to shard Schema and Index Management Loss of relational benefits Azure Table Storage Secondary Indexes Latency Throughput

13 Azure DocumentDB

14 Perfect for these Documents schema-agnostic JSON store for
{ "name": "SmugMug", "permalink": "smugmug", "homepage_url": " "blog_url": " "category_code": "photo_video", "products": [ "permalink": "smugmug" } ], "offices": [ "description": "", "address1": "67 E. Evelyn Ave", "address2": "", "zip_code": "94041", "city": "Mountain View", "state_code": "CA", "country_code": "USA", "latitude": , "longitude": ] Perfect for these Documents schema-agnostic JSON store for hierarchical and de-normalized data at scale

15 Not these documents

16 Perfect for these Documents schema-agnostic JSON store for
10/12/2018 { "name": "SmugMug", "permalink": "smugmug", "homepage_url": " "blog_url": " "category_code": "photo_video", "products": [ "permalink": "smugmug" } ], "offices": [ "description": "", "address1": "67 E. Evelyn Ave", "address2": "", "zip_code": "94041", "city": "Mountain View", "state_code": "CA", "country_code": "USA", "latitude": , "longitude": ] Perfect for these Documents schema-agnostic JSON store for hierarchical and de-normalized data at scale Well nested, multiple properties and values © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

17 Why? Horizontal Scaling for storage and throughput
High performance with SSDs and automatic indexing Operating on a global scale

18 Fully managed as a service
10/12/2018 Fully managed as a service Predictable Performance Hourly Billing 99.95% Availability Adjustable Performance Levels database users, permissions S1 S2 S3 collections … Image licensed under the Creative Commons Attribution 2.0 Generic license: © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

19 Fully managed as a service
10/12/2018 Fully managed as a service Predictable Performance Hourly Billing 99.95% Availability Adjustable Performance Levels database users, permissions S1 S2 S3 collections … Image licensed under the Creative Commons Attribution 2.0 Generic license: I’m not crying anymore © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

20 Request Units Predictable Performance
10/12/2018 Request Units % CPU GET Resource READ % IOPS Resource set Resource POST % Memory INSERT Request Unit (RU) is the normalized currency Replica gets a fixed budget of Request Units Resource PUT Resource REPLACE Predictable Performance Most import metric in DocumentDB! DELETE Resource DELETE Documents SQL POST Query args POST sprocs EXECUTE © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

21 Microsoft Build 2016 10/12/ :23 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

22 Mobile games – cloud backend
10/12/ :23 PM Mobile games – cloud backend Powerful clients, backend used to connect users and enhance play Store data outside mobile device (levels, scores, badges) Facilitate multiplayer games & social gameplay Manage the leaderboard Orchestrate push notifications Facilitate in-game purchases Deliver dynamic game content iOS Windows Android © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

23 Mobile games – cloud backend
10/12/ :23 PM Mobile games – cloud backend Simplified TWD architecture Mobile Game Backend Services Queues iOS Cloud Endpoints Storage Windows Logging / Analytics NoSQL Database Push Notifications Android © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

24 Mobile games – cloud backend
10/12/ :23 PM Mobile games – cloud backend Simplified TWD architecture iOS Storage Queues Cloud Services Storage, CDN Traffic Manager Windows Gaming Analytics Service DocumentDB Notification Hubs Android © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

25 Backend services and state
10/12/ :23 PM Backend services and state Worker roles proffering services over game data In-app purchases Service Game Frontend (SignalR Hub) Leaderboard Service Social & Guild Service Admin Service Notification Service Logging / Analytics Service Gaming storage with DocumentDB Player data and scores Guild and social data © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

26 Scaling player data store
10/12/ :23 PM Scaling player data store { "id": "G02-D06-5d085b11", "CountryCode": "hk", "Nickname": "DannyBoy", "NicknameLower": "dannyboy", "Score": 0, "SecondaryScore": 18, "IndexScore": 0.18, "Level": 1, "HashedId": "b134bd5c5b5748f", "LastSaveUnixTime": , "LastLoadUnixTime": , "DisconnectedUnixTime": , "FacebookId": "FB_ ", "GameCenterId": "GC_G: " } Partitioned on composite id for scale out Low latency (<10 ms) queries Player data – nickname, high scores, alternative IDs Query by alternative social IDs © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

27 Player data APIs AddPlayer UpdatePlayer GetPlayerJsonById
10/12/ :23 PM Player data APIs AddPlayer UpdatePlayer GetPlayerJsonById GetPlayerJsonByHashedId GetPlayerDataSubsetByHashedIds GetPlayerDataByFacebookId GetPlayerDataByGamecenterId GetPlayerDataByGoogleId { "id": "G02-D06-5d085b11", "CountryCode": "hk", "Nickname": "DannyBoy", "NicknameLower": "dannyboy", "Score": 0, "SecondaryScore": 18, "IndexScore": 0.18, "Level": 1, "HashedId": "b134bd5c5b5748f", "LastSaveUnixTime": , "LastLoadUnixTime": , "DisconnectedUnixTime": , "FacebookId": "FB_ ", "GameCenterId": "GC_G: " } © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

28 Guild APIs for social GetGuildJsonById GetGuildMembersById
10/12/ :23 PM Guild APIs for social { "id":"67879d8e", "GuildMembers": [ { "MemberId": "75c14f1d", "Name": "RickGrimes", "PlayerLevel": 7, "Role": "Leader", "State": "Normal", "CurrentChallengeStars": 0, "TotalChallengeStars": 5 }], "GuildMembersPending": [ ], "ChatMessages": [ { "PlayerId": "67879d8e", "Name": "lee", "Message": "hi", "Time": , "NotificationType": "None" }] } GetGuildJsonById GetGuildMembersById AddGuildMember AddPendingGuildMember AddChatMessage © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

29 Data partitioning and re-partitioning
10/12/ :23 PM Data partitioning and re-partitioning Distributing throughput over partitions Data spread with consistent hashing HashFn(N) HashFn(N+1) HashFn(N) HashFn(N+1) © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

30 There isn’t always time for partition management
10/12/ :23 PM There isn’t always time for partition management © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

31 Partitioned collections
10/12/ :23 PM Partitioned collections Scale throughput (RUs) and storage independently Scale beyond current single partition collection limits Adjust reserved throughput based on application requirements © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

32 Creating partitioned collections
10/12/ :23 PM Creating partitioned collections //pre-defined collections DocumentCollection collectionSpec = new DocumentCollection { Id = "Walkers" }; RequestOptions options = new RequestOptions { OfferType = "S3" }; DocumentCollection documentCollection = await client.CreateDocumentCollectionAsync("dbs/" + database.Id, collectionSpec, options); //partitioned collections collectionSpec.PartitionKey.Paths.Add(“/walkerId”); int collectionThroughput = ; RequestOptions options = new RequestOptions { OfferThroughput = collectionThroughput }; © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

33 DocumentDB global databases (Preview)
10/12/ :23 PM DocumentDB global databases (Preview) For applications with global reach Replicated, multi-region databases Access data with low latency Develop multi-region apps with well defined consistency levels Dynamically configure write region © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

34 App defined regional preferences
10/12/ :23 PM App defined regional preferences ConnectionPolicy docClientConnectionPolicy = new ConnectionPolicy { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Tcp }; docClientConnectionPolicy.PreferredLocations.Add(LocationNames.EastUS2); docClientConnectionPolicy.PreferredLocations.Add(LocationNames.WestUS); docClient = new DocumentClient( new Uri(" "PARvqUuBw2QTO4rRXr6d1GnLCR7VinERcYrBQvDRh6EDTJLOHtZxgjTS4pv8nQv2Lg1QQLBLfO6TVziOZKvYow==", docClientConnectionPolicy); © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

35 One more thing…

36 A few One more thing… s

37 Automatic Indexing

38 Query over schema-free JSON
10/12/2018 Query over schema-free JSON SQL Query Grammar -- Nested lookup against index SELECT Books.Author FROM Books WHERE Books.Author.Name = "Leo Tolstoy" -- Transformation, Filters, Array access SELECT { Name: Books.Title, Author: Books.Author.Name } WHERE Books.Price > 10 AND Books.Languages[0] = "English" -- Joins, User Defined Functions (UDF) SELECT CalculateRegionalTax(Books.Price, "USA", "WA") JOIN LanguagesArr IN Books.Languages WHERE LanguagesArr.Language = "Russian" Query over heterogeneous documents without defining schema or managing indexes Query arbitrary paths, properties and values without specifying secondary indexes or indexing hints Execute queries with consistent results in the face of sustained writes Query through fluent language integration including LINQ for .NET developers and a “document oriented“ SQL grammar for traditional SQL developers Extend query execution through application supplied JavaScript UDFs Supported SQL features include; predicates, iterations (arrays), sub-queries, logical operators, UDFs, intra-document JOINs, JSON transforms © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

39 Indexing Example How it works
10/12/2018 Indexing How it works Automatic indexing of documents JSON documents are represented as trees Structural information and instance values are normalized into a JSON-Path Fixed upper bound on index size (typically 20% in real production data) Example {"headquarters": "Belgium"}  /"headquarters"/"Belgium" {"exports": [{"city": “Moscow"}, {"city": Athens"}]}  /"exports"/0/"city"/"Moscow" and /"exports"/1/"city"/"Athens". © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

40 Indexing Policies Configuration Level Options Automatic Per collection
10/12/2018 Indexing Policies Configuration Level Options Automatic Per collection True (default) or False Override with each document write Indexing Mode Consistent or Lazy Lazy for eventual updates/bulk ingestion Included and excluded paths Per path Individual path or recursive includes (? And *) Indexing Type Support Hash and Range Hash for equality, range for range queries Indexing Precision Supports 3 – 7 per path Tradeoff storage, query RUs and write RUs © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

41 Indexing Paths Path Description/use case /
10/12/2018 Indexing Paths Path Description/use case / Default path for collection. Recursive and applies to whole document tree. /"prop"/? Serve queries like the following (with Hash or Range types respectively): SELECT * FROM collection c WHERE c.prop = "value" SELCT * FROM collection c WHERE c.prop > 5 /"prop"/* All paths under the specified label. /"prop"/"subprop"/ Used during query execution to prune documents that do not have the specified path. /"prop"/"subprop"/? Serve queries (with Hash or Range types respectively): SELECT * FROM collection c WHERE c.prop.subprop = "value" SELECT * FROM collection c WHERE c.prop.subprop > 5 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

42 Tunable Consistency

43 Tunable Consistency Levels
10/12/ :23 PM Tunable Consistency Levels Brewer’s CAP Theorem Consistency In theoretical computer science, the CAP theorem, also known as Brewer's theorem, states that it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:[1][2][3] Consistency (all nodes see the same data at the same time) Availability (a guarantee that every request receives a response about whether it succeeded or failed) Partition tolerance (the system continues to operate despite arbitrary message loss or failure of part of the system) Availability Partition Tolerance © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

44 Tunable Consistency Levels
10/12/ :23 PM Tunable Consistency Levels Brewer’s CAP Theorem DocumentDB offers 4 consistency levels Consistency Strong: guarantees that a write is only visible after it is committed durably by the majority quorum of replicas and reads are always acknowledged by the majority read quorum Session: Provides predictable read consistency for a session while offering the low latency writes. Reads are also low latency as it read will be served by a single replica Bounded Staleness: Bounded Staleness consistency guarantees the total order of propagation of writes but reads may lag writes by N seconds or operations (configurable) Eventual: Eventual consistency is the weakest form of consistency wherein a client may get the values which are older than the ones it had seen before, over time Image licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license: Availability Partition Tolerance © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

45 Transaction Integrated JavaScript

46 Transactional Integrated JavaScript
10/12/2018 Transactional Integrated JavaScript Stored Procedures and Triggers Familiar programming model constructs for executing application logic Registered as named, URI addressable, durable resources Scoped to a DocumentDB collection JavaScript as a procedural language to express business logic Language integration JavaScript throw statement results into aborting the transaction Execution JavaScript runtime is hosted on each replica Pre-compiled on registration The entire procedure is wrapped in an implicit database transaction Fully resource governed and sandboxed execution © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

47 Transactional Integrated JavaScript
10/12/2018 Transactional Integrated JavaScript Stored Procedures and Triggers Familiar programming model constructs for executing application logic Registered as named, URI addressable, durable resources Scoped to a DocumentDB collection JavaScript as a procedural language to express business logic Language integration JavaScript throw statement results into aborting the transaction Execution JavaScript runtime is hosted on each replica Pre-compiled on registration The entire procedure is wrapped in an implicit database transaction Fully resource governed and sandboxed execution © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

48 Transactional Integrated JavaScript
10/12/2018 Transactional Integrated JavaScript client.executeStoredProcedureAsync ("procs/1234", ["MasterChief", "SolidSnake“])  .then(function (response) {     console.log(“success!");   }, function (err) {    console.log("Failed to swap!", error);  } ); function(playerId1, playerId2) {     var playersToSwap = __.filter (function (document) {         return (document.id == playerId1 || document.id == playerId2);     });     var player1 = playersToSwap[0], player2 = playersToSwap[1];       var player1ItemTemp = player1.item;     player1.item = player2.item;     player2.item = player1ItemTemp;     __.replaceDocument(player1)         .then(function() { return __.replaceDocument(player2); })         .fail(function(error){ throw 'Unable to update players, abort'; }); } Stored Procedures and Triggers Familiar programming model constructs for executing application logic Registered as named, URI addressable, durable resources Scoped to a DocumentDB collection JavaScript as a procedural language to express business logic Language integration JavaScript throw statement results into aborting the transaction Execution JavaScript runtime is hosted on each replica Pre-compiled on registration The entire procedure is wrapped in an implicit database transaction Fully resource governed and sandboxed execution Client Database © 2015 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

49 Quick Tips

50 Quick Tips De-normalize where appropriate (see other session)
10/12/2018 Quick Tips De-normalize where appropriate (see other session) Collections != Tables General Use a single instance of the DocumentDB client instance Handle server throttles/request rate too large (HTTP Status Code 429) Use point-reads for lookup by id Pre-aggregate where possible Use TTL for expiring data (new) © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

51 Quick Tips Networking .NET SDK usage Non-JSON Data Types
10/12/2018 Quick Tips Networking Use direct connectivity and TCP for performance Collocate clients in same Azure region Debug with HTTPS/Fiddler .NET SDK usage Call OpenAsync() to prevent first call latency Debug: ToString() for LINQ to SQL query translation Non-JSON Data Types DateTimes – use epochs or split up in to year, month, day, etc. Geo-Spatial Indexing via GeoJSON © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

52 Thank You Get started with Azure DocumentDB
Query Demo: { "name": "Andrew Liu", " ": "twitter": }


Download ppt "Azure DocumentDB: Advanced Features for Large-Scale Apps {"

Similar presentations


Ads by Google