MongoDB on Azure for Developersmgreenway.blob.core.windows.net/blog/.../MongoDB-on... · PHP...
Transcript of MongoDB on Azure for Developersmgreenway.blob.core.windows.net/blog/.../MongoDB-on... · PHP...
MongoDB on Azure for DevelopersMark Greenway
Listen to more on this .NET Rocks Episode 921 on
November 7th
Thanks to our
AWESOME sponsors!
What we will talk about
Use Mongo db with C#Patterns for data access / storage
What I won’t cover
Managing serversShardingMassive scaleAbsolutes
Why not cover that?
Dev Team Photo
My Biggest Collection (thus far)
NoSQLNo ACID –PerformanceScaling Simplicity Not Only SQL
http://css.dzone.com/articles/how-acid-mongodb
Mongo itself
Document Database
DatabaseCollection
Document
Key Value
Single Threaded (its JS!)
Server side JS execution BSON Capped Collections
Offerings
C# Access demo
Story Time!
Schema
Uptime Robot
www.uptimerobot.com
So That’s how I used mongo on a project
Curveball
Map
Reduce
Finalize
C#
PHP internals person, author of Xdebug; OpenStreetMap and mapping enthusiast. Works as PHP Engineer/Evangelist for MongoDB at 10gen. derickrethans.nl
Normalizing Data
Familiar with this with SQLBenefitsDrawbacksScenarioAuthor -- Books
De normalizing DataPoint in Time DataThings that will be accessed togetherTags Join tables
Documents should try to be self sufficient
Embed for Atomicity
{"_id": {
"$uuid": "419265a2-f31e-7f06-f8be-1b1649c3db8f"},"PolicyId": 41662,"TagId": 33,"TagName": "Engines","d": false,"l": false,"CurrentVersion": {
"Filename": "Marine Jan10.xls","MD5": "67F6D6C62478F0482B1C1006CD2ABC83","C": {
"$date": "2010-01-14T19:22:36.407Z"},"Usr": "tbridges","ContentType": "application/x-msexcel","Uri": "8578","uploading": false
},
"Versions": [{
"Filename": " Marine Jan10 (1).xls ","MD5": "8C53285C42B0D8DCEAEAA63125DC248D","C": {
"$date": "2010-02-02T13:31:40.970Z"},"Usr": "kcameron","ContentType": "application/x-msexcel","Uri": "9389","uploading": false
},{
"Filename": "Marine Jan10.xls ","MD5": "67F6D6C62478F0482B1C1006CD2ABC83","C": {
"$date": "2010-01-14T19:22:36.407Z"},"Usr": "tbridges","ContentType": "application/x-msexcel","Uri": "8578","uploading": false
},{
"Filename": " Marine Jan10(1).xls ","MD5": "17975AD7D2375CA0FB02F1CAA067CFCC","C": {
"$date": "2010-01-22T15:49:24.500Z"},"Usr": "kcameron","ContentType": "application/x-msexcel","Uri": "8945","uploading": false
}]
C# Access
C# Constructor with Factory
Demo
Web API with SQLMy way - CRUD start
Web API with Mongo
Side by Side
Giant page of numbersSQL Mongo
Get all Get 1 Create Update Get all Get 1 Create Update1 84 79 257 261 66 49 51 812 81 77 165 157 60 50 46 493 68 68 165 176 53 49 46 474 79 74 254 197 52 47 50 545 87 85 240 302 49 51 48 526 75 62 166 164 50 48 51 467 66 60 162 169 52 47 51 468 80 68 156 191 61 46 48 559 112 69 226 184 85 48 51 4810 71 66 173 201 50 50 48 47
0
100
200
300
400
Get all Get 1 Create Update
Orange SQL - Blue Mongo
Average Percent Faster
Get all Get 1 Create Update
28% 31% 75% 74%
References http://docs.mongodb.org/manual/
50 Tips and Tricks for MongoDB Developers by Kristina Chodorow (O’Reilly). Copyright 2011 Kristina Chodorow, 978-1-449-30461-4.
MongoDB Applied Design Patterns by Rick Copeland (O’Reilly). Copyright 2013 Richard D. Copeland, Jr., 978-1-449-34004-9.
MongoDB on Azure for Developers
Mark Greenway@markKgreenway
Listen to more on this .NET Rocks Episode 921 on
November 7th
Extra Time?Name a scenarionormalize vs. de-normalize data