MongoDb - Details on the POC


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

MongoDb - Details on the POC

  1. 1. Goodbye rows and tables, hello documents and collections
  2. 2. Lots of pretty pictures to fool you.
  3. 3. Noise
  4. 4. Introduction M ongoDB bridges the gap between key-value stores (which are fast and highly scalable) and traditional RDBMS systems (which provide rich queries and deep functionality). MongoDB is document-oriented , schema-free , scalable , high-performance , open source. Written in C++ Mongo is not a relational database like MySQL Goodbye rows and tables, hello documents and collections <ul><li>Features </li></ul><ul><li>Document-oriented </li></ul><ul><ul><li>Documents (objects) map nicely to programming language data types </li></ul></ul><ul><ul><li>Embedded documents and arrays reduce need for joins </li></ul></ul><ul><ul><li>No joins and no multi-document transactions for high performance and easy scalability </li></ul></ul><ul><li>High performance </li></ul><ul><ul><li>No joins and embedding makes reads and writes fast </li></ul></ul><ul><ul><li>Indexes including indexing of keys from embedded documents and arrays </li></ul></ul><ul><li>High availability </li></ul><ul><ul><li>Replicated servers with automatic master failover </li></ul></ul><ul><li>Easy scalability </li></ul><ul><ul><li>Automatic sharding (auto-partitioning of data across servers) </li></ul></ul><ul><ul><ul><li>Reads and writes are distributed over shards </li></ul></ul></ul><ul><ul><ul><li>No joins or multi-document transactions make distributed queries easy and fast </li></ul></ul></ul><ul><ul><li>Eventually-consistent reads can be distributed over replicated servers </li></ul></ul>
  5. 5. <ul><li>Cost - MongoDB is free </li></ul><ul><li>MongoDb is easily installable. </li></ul><ul><li>MongoDb supports various programming languages like C, C++, Java,Javascript, PHP. </li></ul><ul><li>MongoDB is blazingly fast </li></ul><ul><li>MongoDB is schemaless </li></ul><ul><li>Ease of scale-out </li></ul><ul><li>If load increases it can be distributed to other nodes across computer networks. </li></ul><ul><li>It's trivially easy to add more fields -- even complex fields -- to your objects. </li></ul><ul><li>So as requirements change, you can adapt code quickly. </li></ul><ul><li>Background Indexing </li></ul><ul><li>MongoDB is a stand-alone server </li></ul><ul><li>Development time is faster, too, since there are no schemas to manage. </li></ul><ul><li>It supports Server-side JavaScript execution. </li></ul><ul><li>Which allows a developer to use a single programming language for both client and server side code </li></ul>Why ?
  6. 6. <ul><li>Mongo is limited to a total data size of 2GB for all databases in 32-bit mode. </li></ul><ul><li>No referential integrity </li></ul><ul><li>Data size in MongoDB is typically higher. </li></ul><ul><li>At the moment Map/Reduce (e.g. to do aggregations/data analysis) is OK, </li></ul><ul><li>but not blisteringly fast. </li></ul><ul><li>Group By : less than 10,000 keys. </li></ul><ul><li>For larger grouping operations without limits, please use map/reduce . </li></ul><ul><li>Lack of predefined schema is a double-edged sword </li></ul><ul><li>No support for Joins & transactions </li></ul>Limitations
  7. 7. Benchmarking (MongoDB Vs. MySQL) Test Machine configuration: CPU : Intel Xeon 1.6 GHz - Quad Core, 64 Bit Memory : 8 GB RAM OS : Centos 5.2 - Kernel 2.6.18 64 bit Record Structure Field1 -> String, Indexed Field2 -> String, Indexed Filed3 -> Date, Not Indexed Filed4 -> Integer, Indexed
  8. 8. Mongo data model <ul><li>A Mongo system (see deployment above) holds a set of databases </li></ul><ul><li>A database holds a set of collections </li></ul><ul><li>A collection holds a set of documents </li></ul><ul><li>A document is a set of fields </li></ul><ul><li>A field is a key-value pair </li></ul><ul><li>A key is a name (string) </li></ul><ul><li>A value is a </li></ul><ul><ul><li>basic type like string, integer, float, timestamp, binary, etc., </li></ul></ul><ul><ul><li>a document, or </li></ul></ul><ul><ul><li>an array of values </li></ul></ul>MySQL Term Mongo Term database database table collection index index row BSON document column BSON field Primary key _id field
  9. 9. SQL to Mongo Mapping Chart
  10. 10. Continued ... SQL Statement Mongo Statement
  11. 11. Replication / Sharding <ul><li>Data Redundancy </li></ul><ul><li>Automated Failover </li></ul><ul><li>Distribute read load </li></ul><ul><li>Simplify maintenance </li></ul><ul><li>(compared to &quot;normal&quot; master-slave) </li></ul><ul><li>Disaster recovery from user error </li></ul><ul><li>Automatic balancing for changes in </li></ul><ul><li>load and data distribution </li></ul><ul><li>Easy addition of new machines </li></ul><ul><li>Scaling out to one thousand nodes </li></ul><ul><li>No single points of failure </li></ul><ul><li>Automatic failover </li></ul>
  12. 12. These slides are online: