Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Kevin WrightJonathan Roeder
   Kevin Wright (The long-haired hippie one)    ◦ Over 100 years of experience! (Just look at this      PowerPoint Templa...
   Founded in 1999   SaaS eCommerce and related services   40,000+ Online stores   330+ Employees   $2.8B processed o...
   Dog Fridays   Guys in suspenders!
   Just who are you guys?
WHY write one?The world needed ONE MORE!?!Critical focus on Multi-Tenancy Focus on Small footprint / Efficient scaling
What it is: .NET REST Service Standard use case of enabling CMS users to  define Meta schemas (Content & Property  Types...
   Initial approach programmatically provisioned    a Mongo Database for each Tenant.   Reinventing the wheel with datab...
   Opt-in per Collection   Don’t do it to earn your Sharding merit badge   Read the documentation three times.   Imple...
   .NET static type system + MongoDB dynamic    schema is like mixing Simon and Garfunkel    …(it can be great if you don...
KEVIN WILL DEMO Mongo SHELL MONGOVUE LINQPAD
   Be as static as you can be.    ◦ POCO types for each MongoDB Document schema      (Data Transfer Object, DTO pattern) ...
   Now that you’ve created static types, leverage    them!
   LINQ support is great. Just know that:    ◦ No projection [CSHARP-456]    ◦ Hard to mix in dynamic schema elements (us...
3 HITCOMBO   !!!
   Laser focus your Updates
   Be careful with the blanket Save method!    ◦ Can’t stop it from Upserting    ◦ Often overkill to replace entire Docum...
   Data modeling without Joins   Concurrency modeling without Transactions
   Denormalize!
   If your data can’t be dirty, don’t denoramlize   Example: Store only the FolderId on Content    Document instead of m...
   MongoDB.org approaches for actually    retrieving the Folders :    http://docs.mongodb.org/manual/tutorial/m    odel-t...
   Optimistic Concurrency   Benign Writes   Benign Wrongs   Compensate   Be prepared to carefully think this through....
   Vote!
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#
Upcoming SlideShare
Loading in …5
×

Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#

18,330 views

Published on

  • Be the first to comment

Lessons Learned from Building a Multi-Tenant Saas Content Management System on Mongo with C#

  1. 1. Kevin WrightJonathan Roeder
  2. 2.  Kevin Wright (The long-haired hippie one) ◦ Over 100 years of experience! (Just look at this PowerPoint Template!) ◦ Worked on the Space Station! ◦ 2 years of Mongo experience Jonathan Roeder (The short-haired hipster one) ◦ 10 years of High Scale eCommerce / CMS / Search ◦ 1.5 years of Mongo experience
  3. 3.  Founded in 1999 SaaS eCommerce and related services 40,000+ Online stores 330+ Employees $2.8B processed on our platform in 2012
  4. 4.  Dog Fridays Guys in suspenders!
  5. 5.  Just who are you guys?
  6. 6. WHY write one?The world needed ONE MORE!?!Critical focus on Multi-Tenancy Focus on Small footprint / Efficient scaling
  7. 7. What it is: .NET REST Service Standard use case of enabling CMS users to define Meta schemas (Content & Property Types) CRUD operations on Data that conforms to the Meta schemas (Content) Structures for organizing Content (Content Lists and Folders)
  8. 8.  Initial approach programmatically provisioned a Mongo Database for each Tenant. Reinventing the wheel with database management. Suffering from two minute incremental boot up time per Database was untenable (get it!). New approach: Embrace Sharding as the appropriate scale out approach
  9. 9.  Opt-in per Collection Don’t do it to earn your Sharding merit badge Read the documentation three times. Implement four times. (a.k.a Prototype) The Along Came Polly joke will never get old
  10. 10.  .NET static type system + MongoDB dynamic schema is like mixing Simon and Garfunkel …(it can be great if you don’t Garfunkel it up) Driver allows for pure dynamic schema interaction but is maturing to allow type safe access via Lambdas and LINQ. ◦ Aggregation framework tbd [CSHARP-601]
  11. 11. KEVIN WILL DEMO Mongo SHELL MONGOVUE LINQPAD
  12. 12.  Be as static as you can be. ◦ POCO types for each MongoDB Document schema (Data Transfer Object, DTO pattern) ◦ Leverage compile-time safety. The newest driver makes it easy with Generics and Lambdas ◦ Duck-typing and magic strings are for gooses! Explore very rich serialization hooks and levers ◦ (SetIgnoreIfNullConvention, BsonExtraElements,…)
  13. 13.  Now that you’ve created static types, leverage them!
  14. 14.  LINQ support is great. Just know that: ◦ No projection [CSHARP-456] ◦ Hard to mix in dynamic schema elements (use Inject extension method) Fall back to MongoDB.Driver.Builders.Query<T> or QueryBuilder<T> ◦ Mix in dynamic schema elements via non-generic version
  15. 15. 3 HITCOMBO !!!
  16. 16.  Laser focus your Updates
  17. 17.  Be careful with the blanket Save method! ◦ Can’t stop it from Upserting ◦ Often overkill to replace entire Document
  18. 18.  Data modeling without Joins Concurrency modeling without Transactions
  19. 19.  Denormalize!
  20. 20.  If your data can’t be dirty, don’t denoramlize Example: Store only the FolderId on Content Document instead of materialized Folder path ◦ Pros: Updates are easy! ◦ Cons: Queries are hard! ◦ When wanting to find Content within child Folders, must first query for all child Folders, then OR those IDs using the ‘In’ operator
  21. 21.  MongoDB.org approaches for actually retrieving the Folders : http://docs.mongodb.org/manual/tutorial/m odel-tree-structures/
  22. 22.  Optimistic Concurrency Benign Writes Benign Wrongs Compensate Be prepared to carefully think this through. http://blog.mongodb.org/post/475279604/ on-distributed-consistency-part-1 http://docs.mongodb.org/manual/tutorial/p erform-two-phase-commits/
  23. 23.  Vote!

×