Neotys conference
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
304
On Slideshare
304
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
14
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Technical Evangelist,MongoDB
 @tgrall Tugdual “Tug” Grall @Neotys SQLvs NoSQL Performance A MongoDB perspective
  • 2. @tgralltug@mongodb.com { “about” : “me” } Tugdual“Tug”Grall • MongoDB • Technical Evangelist • Couchbase • Technical Evangelist • eXo • CTO • Oracle • Developer/Product Manager • Mainly Java/SOA • Developer in consulting firms • Web • @tgrall • http://blog.grallandco.com • tgrall • NantesJUG co-founder • Pet Project : • http://www.resultri.com • tug@mongodb.com • tugdual@gmail.com
  • 3. Why MongoDB ?
  • 4. @tgralltug@mongodb.com Relational Database
  • 5. @tgralltug@mongodb.com
  • 6. @tgralltug@mongodb.com And makes things hard to change Name Age Phone Email New Column New Table New Table New Column
  • 7. @tgralltug@mongodb.com It runs on expensive hardware “Clients can also opt to run zEC12 without a raised datacenter floor -- a first for high-end IBM mainframes.” ! ! IBM Press Release 28 Aug, 2012!
  • 8. @tgralltug@mongodb.com This was a problem for Google 250,000+MBP’s==4.1miles 2010 Search Index Size: ! 100,000,000 GB New data added per day! 100,000+ GB Databases they could use! 0
  • 9. @tgralltug@mongodb.com And for Facebook
  • 10. What is MongoDB?
  • 11. @tgralltug@mongodb.com MongoDB Vision To provide the best database for how we build and run apps today Build • New and complex data • Flexible • New languages • Faster development Run • Big Data scalability • Real-time • Commodity hardware • Cloud
  • 12. @tgralltug@mongodb.com Documents are easier Relational MongoDB {      first_name:  "Paul",    surname:  "Miller",    city:  "London",    location:  [45.123,47.232],    cars:  [          {  model:  "Bentley",            year:  1973,            value:  100000,  …  },        {  model:  "Rolls  Royce",              year:  1965,              value:  330000,  …  }      ] }
  • 13. @tgralltug@mongodb.com Full Featured Queries • Find Paul’s cars • Find everybody in London with a car built between 1970 and 1980 Geospatial • Find all of the car owners within 5km of Trafalgar Sq. Text Search • Find all the cars described as having leather seats Aggregation • Calculate the average value of Paul’s car collection Map Reduce • What is the ownership pattern of colors by geography over time? (is purple trending up in China?) { first_name: ‘Paul’, surname: ‘Miller’, city: ‘London’, location: { ! type: “Point”, ! coordinates : ! ! [-0.128, 51.507] ! },! cars: [ { model: ‘Bentley’, year: 1973, value: 100000, … }, { model: ‘Rolls Royce’, year: 1965, value: 330000, … } } }
  • 14. @tgralltug@mongodb.com Easier and Cheaper to Scale Vs. Price Scale Price Scale
  • 15. @tgralltug@mongodb.com 7,000,000+ MongoDB Downloads 150,000+ Online Education Registrants 25,000+ MongoDB User Group Members 25,000+ MongoDB Management Service (MMS) Users 20,000+ MongoDB Days Attendees
  • 16. @tgralltug@mongodb.com MongoDB Use Cases 16 Big Data Product & Asset Catalogs Security & 
 Fraud Internet of Things Database-as-a- Service Mobile 
 Apps Customer Data Management Data 
 Hub Social & Collaboration Content Management Intelligence Agencies Top Investment and Retail Banks Top US Retailer Top Global Shipping Company Top Industrial Equipment Manufacturer Top Media Company Top Investment and Retail Banks
  • 17. MongoDB Deployments
  • 18. @tgralltug@mongodb.com High Availability : Replication
  • 19. @tgralltug@mongodb.com Horizontal Scalability: Sharding Shard 1 Shard 1 Shard nShard 1 … Horizontally Scalable
  • 20. @tgralltug@mongodb.com MongoDB Architecture
  • 21. @tgralltug@mongodb.com Multi Data Center
  • 22. Performance
  • 23. MongoDB is a Distributed Database Insert Update Delete Query Aggregations
  • 24. @tgralltug@mongodb.com Queries
  • 25. @tgralltug@mongodb.com Analyze Query Performance • Use query explain() cursor method • Use Database Profiler to find slow queries db.inventory.find( { type: 'food' } ).explain()! ! {! "cursor" : "BtreeCursor type_1",! "isMultiKey" : false,! "n" : 5,! "nscannedObjects" : 5,! "nscanned" : 5,! "nscannedObjectsAllPlans" : 5,! "nscannedAllPlans" : 5,! …! "scanAndOrder" : false,! "millis" : 0,! "indexBounds" : { "type" : [! [ "food",! "food" ]! ] },! "server" : "mongodbo0.example.net:27017" }
  • 26. @tgralltug@mongodb.com Monitoring the system
  • 27. @tgralltug@mongodb.com Monitor: What to look? Locks Avoid long running operations that could slow down the database Page Faults Check that the working set stays in RAM, reduce I/O operations Nbr of Connections Reduce RAM consumption Replication Lag Time to copy the data to secondaries OpLog Size Size of the replication queue Chunk Distribution Data should be balanced on all the nodes
  • 28. @tgralltug@mongodb.com Many tools / Many Metrics • MMS : MongoDB Management Services • CLI and RESTAPI • Neotys
  • 29. More..
  • 30. You must prepare your deployment
  • 31. @tgralltug@mongodb.com The most important part
  • 32. @tgralltug@mongodb.com Node 1 Secondary Config Server Node 1 Secondary Config Server Node 1 Secondary Config Server Shard Shard Shard Mongos App Server Mongos App Server Mongos App Server A good shard key
  • 33. @tgralltug@mongodb.com Example : email storage Cardinality! Write Scaling! Query Isolation! Reliability! Index! Locality! _id! Doc level! One shard! Scatter/ gather! All users affected! Good! hash(_id)! Hash level! All Shards! Scatter/ gather! All users affected! Poor! user! Many docs! All Shards! Targeted Some users affected Good! user, time! Doc level! All Shards! Targeted! Some users affected Good!
  • 34. Conclusion
  • 35. @tgralltug@mongodb.com Conclusion • MongoDB is a general purpose database • Document Design • Create Index and check the explain plans • MongoDB is a distributed database • Choose the shard key wisely • MongoDB use replication • Check OpLog and Replication Lag • Monitor all these with tools
  • 36. Questions?
  • 37. @tgrall @neotys ThankYou