SlideShare a Scribd company logo
1 of 22
MongoDB

And NoSQL Databases
MongoDB Overview
•   From “humongous”
•   Document-oriented database, not relational
•   Schema free
•   Manages hierarchical collection of BSON (bee-son) documents
•   Written in C++
•   Has an official driver for C# with support from 10gen
•   Scalable with high-performance (scales horizontally)
•   Designed to address today’s workloads
•   BASE rather than ACID compliant
•   Replication
•   Part of the “NoSQL” class of DBMS
•   Website with list of all features - http://www.mongodb.org/
What is NoSQL?
• Class of DBMS that differ from relational model
• Do not expose the standard SQL interface
• May not require fixed table schemas, usually
  avoid join operations, and typically scale horizontally.
• Term coined by Carlo Strozzi in 1998 to name his lightweight,
  open-source relational database that did not expose the
  standard SQL interface.
• However as Strozzi said, because the current NoSQL
  movement is departing “from the relational model
  altogether; it should therefore have been called more
  appropriately 'NoREL', or something to that effect.“
• http://nosql-database.org/ for examples.
Why are these interesting?
• New requirements are arising in environments where we have
  higher volumes of data with high operation rates, agile
  development and cloud computing. This reflects the growing
  interactivity of applications which are becoming more
  networked and social, driving more requests to the database
  where high-performance DBMS such as MongoDB become
  favorable.
• Not requiring a schema or migration scripts before you add
  data makes it fit well with agile development approaches.
  Each time you complete new features, the schema of your
  database often needs to change. If the database is large, this
  can mean a slow process.
ACID
• Relational databases make the ACID promise:
     –      Atomicity - a transaction is all or nothing
     –      Consistency - only valid data is written to the database
     –      Isolation - pretend all transactions are happening serially and the data is correct
     –      Durability - what you write is what you get
• The problem is ACID can give you too much, it trips you up when you are
  trying to scale a system across multiple nodes.
• Down time is unacceptable so your system needs to be reliable. Reliability
  requires multiple nodes to handle machine failures.
• To make scalable systems that can handle lots and lots of reads and writes
  you need many more nodes.
• Once you try to scale ACID across many machines you hit problems with
  network failures and delays. The algorithms don't work in a distributed
  environment at any acceptable speed.

   http://highscalability.com/drop-acid-and-think-about-data
CAP
•   If you can't have all of the ACID guarantees it turns out you can have two of the following
    three characteristics:
     –    Consistency - your data is correct all the time. What you write is what you read.
     –    Availability - you can read and write and write your data all the time
     –    Partition Tolerance - if one or more nodes fails the system still works and becomes consistent when
          the system comes on-line.
•   In distributed systems, network partitioning is inevitable and must be tolerated, so essential
    CAP means that we cannot have both consistency and 100% availability.
    “If the network is broken, your database won’t work.”
•   However, we do get to pick the definition of “won’t work”. It can either mean down
    (unavailable) or inconsistent (stale data).

    http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
BASE
•    The types of large systems based on CAP aren't ACID, they are BASE (ha ha)
       – Basically Available - system seems to work all the time
       – Soft State - it doesn't have to be consistent all the time
       – Eventually Consistent - becomes consistent at some later time
•    Many companies building big applications build them on CAP and BASE: Google, Yahoo,
     Facebook, Amazon, eBay, etc.

•    Amazon popularized the concept of “Eventual Consistency”. Their definition is:
       the storage system guarantees that if no new updates are made to the object, eventually all
       accesses will return the last updated value.
•    A few examples of eventually consistent systems:
       – Asynchronous master/slave replication on an RDBMS or MongoDB
       – DNS
       – memcached in front of mysql, caching reads

For more depth and different configuration examples: http://blog.mongodb.org/post/498145601/on-distributed-consistency-part-
     2-some-eventual
To get an idea..
BSON
• Stands for Binary JSON
• Is a binary encoded serialisation of JSON-like documents.
• Like JSON, BSON supports the embedding of documents and
  arrays within other documents and arrays. BSON also contains
  extensions that allow representation of data types that are
  not part of the JSON spec. For example, BSON has a Date type
  and a BinData type.
• The driver performs translation from the language’s “object”
  (ordered associative array) data representation to BSON, and
  back:
• C#: new BsonDocument("x", 1) Javascript: {x: 1}
Querying in MongoDB
• The query expression in MongoDB (and other things, such as index key
  patterns) is represented like JSON objects (BSON).
  However, the actual verb (e.g. "find") is done in one's regular
  programming language.
• Usually we think of query object as the equivalent of a SQL "WHERE"
  clause:
   C#:               db[“users"].Find(Query. EQ(“x”, 3)).SetSortOrder(SortBy.Ascending(“y"));
                     // select * from users where x=3 order by x asc;
Javascript:          db.users.find( {x : 3} ).sort( {y : 1} );

   More on ways of creating queries:
   http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTutorial-
   FindandFindAsmethods

• Note: In MongoDB, just like in an RDBMS, creating appropriate indexes for
  queries is quite important for performance.

• For a quick tutorial using the shell visit http://try.mongodb.org/
•   To insert a document in the collection create an object representing the document
    and call Insert. The object can be an instance of BsonDocument or of any class that
    can be successfully serialized as a BSON document. For example:




•   If you have a class called Book the code might look like:




•   You can insert more than one document at a time using the InsertBatch method. For
    example:
A Many to Many Association
• In a relational DBMS use an intersection table and joins
• In MongoDB use either embedding or linking

  BsonDocument user = new BsonDocument {
       { "name", "John" },
       { "roles", new BsonArray{“Admin”, “User”, “Engineer”}}
  };
  users.Insert(user);

  //To get all Engineers
  users.Find(Query.EQ(“roles”,”Engineer”));
• Embedding is the nesting of objects and arrays inside
  a BSON document. Links are references between
  documents.
• There are no joins in MongoDB – distributed joins
  would be difficult on a 1,000 server cluster.
  Embedding is a bit like "prejoined" data. Operations
  within a document are easy for the server to handle;
  these operations can be fairly rich. Links in contrast
  must be processed client-side by the application; the
  application does this by issuing a follow-up query.
• Generally, for "contains" relationships between
  entities, embedding should be chosen. Use linking
  when not using linking would result in duplication of
  data.
More detail on referencing:
http://www.mongodb.org/display/DOCS/Database+References
Replication through Replica Sets
• Replica sets are a form of asynchronous master/slave replication, adding
  automatic failover and automatic recovery of member nodes.
• A replica set consists of two or more nodes that are copies of each other.
  (i.e.: replicas)
• The replica set automatically elects a primary (master). No one member is
  intrinsically primary; that is, this is a share-nothing design.
• Drivers (and mongos) can automatically detect when a replica set primary
  changes and will begin sending writes to the new primary. (Also works
  with sharding)
• Replica sets have several common uses (detail in next slide):
    –   Data Redundancy
    –   Automated Failover / High Availability
    –   Distributing read load
    –   Simplify maintenance (compared to "normal" master-slave)
    –   Disaster recovery
• http://www.mongodb.org/display/DOCS/Replica+Sets
Why Replica Sets
•   Data Redundancy
     –   Replica sets provide an automated method for storing multiple copies of your data.
     –   Supported drivers allow for the control of "write concerns". This allows for writes to be confirmed by multiple nodes
         before returning a success message to the client.
•   Automated Failover
     –   Replica sets will coordinate to have a single primary in a given set.
     –   Supported drivers will recognize the change of a primary within a replica set.
           •   In most cases, this means that the failure of a primary can be handled by the client without any configuration changes.
     –   A correctly configured replica set basically provides a “hot backup”. Recovering from backups is typically very time
         consuming and can result in data loss. Having an active replica set is generally much faster than working with backups.
•   Read Scaling
     –   By default, the primary node of a replica set is accessed for all reads and writes.
     –   Most drivers provide a slaveOkay method for identifying that a specific operation can be run on a secondary node.
         When using slaveOkay, a system can share the read load amongst several nodes.
•   Maintenance
     –   When performing tasks such as upgrades, backups and compaction, it is typically required to remove a node from
         service.
     –   Replica sets allow for these maintenance tasks to be performed while operating a production system. As long as the
         production system can withstand the removal of a single node, then it’s possible to perform a “rolling” upgrade on
         such things.
•   Disaster Recovery
     –   Replica sets allows for a “delayed secondary” node.
     –   This node can provide a window for recovering from disastrous events such as:
           •   bad deployments
           •   dropped tables and collections
Horizontal Scalability

• Rather than buying bigger servers, MongoDB scales by
  adding additional servers - improvements come in the
  form of more processors and cores rather than faster
  processors from packing more CPUs and ram into a
  server (vertical scaling).
• MongoDB easily supports high transaction rate
  applications because as more servers are added,
  transactions are distributed across the larger cluster of
  nodes, which linearly increases database capacity. With
  this model additional capacity can be added without
  reaching any limits.
• MongoDB achieves this through auto-sharding.
Sharding
• For applications that outgrow the resources of a single database server,
  MongoDB can convert to a sharded cluster, automatically managing
  failover and balancing of nodes, with few or no changes to the original
  application code.
• Each shard consists of one or more servers and stores data
  using mongod processes (mongod being the core MongoDB database
  process). In a production situation, each shard will consist of multiple
  replicated servers per shard to ensure availability and automated failover.
  The set of servers/mongod process within the shard comprise a replica
  set.
• Sharding offers:
    –   Automatic balancing for changes in load and data distribution
    –   Easy addition of new machines
    –   Scaling out to one thousand nodes
    –   No single points of failure
    –   Automatic failover
• http://www.mongodb.org/display/DOCS/Sharding+Introduction
Large MongoDB Deployment example
1. One or more shards, each shard holds a portion of the total data (managed
    automatically). Reads and writes are automatically routed to the appropriate
    shard(s). Each shard is backed by a replica set – which just holds the data for that
    shard.
    A replica set is one or more servers, each holding copies of the same data. At any
    given time one is primary and the rest are secondaries. If the primary goes down
    one of the secondaries takes over automatically as primary. All writes and
    consistent reads go to the primary, and all eventually consistent reads are
    distributed amongst all the secondaries.
2. Multiple config servers, each one holds a copy of the meta data indicating which
    data lives on which shard.
3. One or more routers, each one acts as a server for one or more clients. Clients issue
    queries/updates to a router and the router routes them to the appropriate shard
    while consulting the config servers.
4. One or more clients, each one is (part of) the user's application and issues
    commands to a router via the mongo client library (driver) for its language.

mongod is the server program (data or config). mongos is the router program.
Companies using MongoDB
• Just a few here..
• Foursquare – moved over from PostgreSQL
• Craigslist – moved over from a large MySQL cluster. Schema
  changes were taking forever and it wasn’t really relational
  information. They wanted to be able to add new machines without
  downtime (which sharding provides) and route around dead
  machines without clients failing (which replica sets provide).
• Sourcefourge – moved over from MySQL. MongoDB is used for
  back-end storage on the SourceForge front pages, project pages,
  and download pages for all projects.
• The New York Times - using it in a form-building application for
  photo submissions. Mongo's dynamic schema gives producers the
  ability to define any combination of custom form fields.
• Full list at
  http://www.mongodb.org/display/DOCS/Production+Deployments
Further Resources
• Article: Going NoSQL with MongoDB
• C# Driver Tutorial
• GUI Tool like Management Studio -
  http://www.mongovue.com/
• 10gen White Paper
• http://www.mongodb.com/
• Wikipedia pages for MongoDB, NoSQL etc.
• Google Groups mongodb-user and mongodb-csharp

More Related Content

What's hot

NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using HazelcastTaras Matyashovsky
 
HBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBaseCon
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodbMohammed Ragab
 
Usage case of HBase for real-time application
Usage case of HBase for real-time applicationUsage case of HBase for real-time application
Usage case of HBase for real-time applicationEdward Yoon
 
Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101IDERA Software
 
LinkedIn - A highly scalable Architecture on Java!
LinkedIn - A highly scalable Architecture on Java!LinkedIn - A highly scalable Architecture on Java!
LinkedIn - A highly scalable Architecture on Java!manivannan57
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInLinkedIn
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...Ashnikbiz
 
Stability Patterns for Microservices
Stability Patterns for MicroservicesStability Patterns for Microservices
Stability Patterns for Microservicespflueras
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalabilityjbellis
 
Codemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech labCodemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech labUgo Landini
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Applicationsupertom
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitationsBRIJESH KUMAR
 
Intro to HBase - Lars George
Intro to HBase - Lars GeorgeIntro to HBase - Lars George
Intro to HBase - Lars GeorgeJAX London
 
Nuxeo JavaOne 2007 presentation (in original format)
Nuxeo JavaOne 2007 presentation (in original format)Nuxeo JavaOne 2007 presentation (in original format)
Nuxeo JavaOne 2007 presentation (in original format)Stefane Fermigier
 
High availability solutions bakostech
High availability solutions bakostechHigh availability solutions bakostech
High availability solutions bakostechViktoria Bakos
 
HBaseCon 2015- HBase @ Flipboard
HBaseCon 2015- HBase @ FlipboardHBaseCon 2015- HBase @ Flipboard
HBaseCon 2015- HBase @ FlipboardMatthew Blair
 
Performance Analysis of HBASE and MONGODB
Performance Analysis of HBASE and MONGODBPerformance Analysis of HBASE and MONGODB
Performance Analysis of HBASE and MONGODBKaushik Rajan
 

What's hot (20)

NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using Hazelcast
 
HBase: Where Online Meets Low Latency
HBase: Where Online Meets Low LatencyHBase: Where Online Meets Low Latency
HBase: Where Online Meets Low Latency
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Usage case of HBase for real-time application
Usage case of HBase for real-time applicationUsage case of HBase for real-time application
Usage case of HBase for real-time application
 
Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101
 
LinkedIn - A highly scalable Architecture on Java!
LinkedIn - A highly scalable Architecture on Java!LinkedIn - A highly scalable Architecture on Java!
LinkedIn - A highly scalable Architecture on Java!
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
 
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
FOSSASIA 2015 - 10 Features your developers are missing when stuck with Propr...
 
Stability Patterns for Microservices
Stability Patterns for MicroservicesStability Patterns for Microservices
Stability Patterns for Microservices
 
What Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database ScalabilityWhat Every Developer Should Know About Database Scalability
What Every Developer Should Know About Database Scalability
 
Codemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech labCodemotion 2015 Infinispan Tech lab
Codemotion 2015 Infinispan Tech lab
 
Using Cassandra with your Web Application
Using Cassandra with your Web ApplicationUsing Cassandra with your Web Application
Using Cassandra with your Web Application
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitations
 
Intro to HBase - Lars George
Intro to HBase - Lars GeorgeIntro to HBase - Lars George
Intro to HBase - Lars George
 
Nuxeo JavaOne 2007 presentation (in original format)
Nuxeo JavaOne 2007 presentation (in original format)Nuxeo JavaOne 2007 presentation (in original format)
Nuxeo JavaOne 2007 presentation (in original format)
 
High availability solutions bakostech
High availability solutions bakostechHigh availability solutions bakostech
High availability solutions bakostech
 
HBaseCon 2015- HBase @ Flipboard
HBaseCon 2015- HBase @ FlipboardHBaseCon 2015- HBase @ Flipboard
HBaseCon 2015- HBase @ Flipboard
 
Performance Analysis of HBASE and MONGODB
Performance Analysis of HBASE and MONGODBPerformance Analysis of HBASE and MONGODB
Performance Analysis of HBASE and MONGODB
 

Viewers also liked

MongoDB - javascript for your data
MongoDB - javascript for your dataMongoDB - javascript for your data
MongoDB - javascript for your dataaaronheckmann
 
introduction to Mongodb
introduction to Mongodbintroduction to Mongodb
introduction to MongodbASIT
 
Deriving an Emergent Relational Schema from RDF Data
Deriving an Emergent Relational Schema from RDF DataDeriving an Emergent Relational Schema from RDF Data
Deriving an Emergent Relational Schema from RDF DataGraph-TA
 
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...Search-Based Testing of Relational Schema Integrity Constraints Across Multip...
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...Gregory Kapfhammer
 
MongoDB: Queries and Aggregation Framework with NBA Game Data
MongoDB: Queries and Aggregation Framework with NBA Game DataMongoDB: Queries and Aggregation Framework with NBA Game Data
MongoDB: Queries and Aggregation Framework with NBA Game DataValeri Karpov
 
OSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialOSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialSteven Francia
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ARADHYAYANA
 

Viewers also liked (13)

MongoDB - javascript for your data
MongoDB - javascript for your dataMongoDB - javascript for your data
MongoDB - javascript for your data
 
introduction to Mongodb
introduction to Mongodbintroduction to Mongodb
introduction to Mongodb
 
Deriving an Emergent Relational Schema from RDF Data
Deriving an Emergent Relational Schema from RDF DataDeriving an Emergent Relational Schema from RDF Data
Deriving an Emergent Relational Schema from RDF Data
 
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...Search-Based Testing of Relational Schema Integrity Constraints Across Multip...
Search-Based Testing of Relational Schema Integrity Constraints Across Multip...
 
NoSQL
NoSQLNoSQL
NoSQL
 
MongoDB: Queries and Aggregation Framework with NBA Game Data
MongoDB: Queries and Aggregation Framework with NBA Game DataMongoDB: Queries and Aggregation Framework with NBA Game Data
MongoDB: Queries and Aggregation Framework with NBA Game Data
 
Normalization
NormalizationNormalization
Normalization
 
OSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB TutorialOSCON 2012 MongoDB Tutorial
OSCON 2012 MongoDB Tutorial
 
Sql Injection Myths and Fallacies
Sql Injection Myths and FallaciesSql Injection Myths and Fallacies
Sql Injection Myths and Fallacies
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
 
Erd examples
Erd examplesErd examples
Erd examples
 

Similar to MongoDB

Altoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsAltoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsJeff Harris
 
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...Big Data Storage Concepts from the "Big Data concepts Technology and Architec...
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...raghdooosh
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterChris Henry
 
NoSQLDatabases
NoSQLDatabasesNoSQLDatabases
NoSQLDatabasesAdi Challa
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOOJames Hollingworth
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Ahmed Rashwan
 
MongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of viewMongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of viewPierre Baillet
 
Scalability Considerations
Scalability ConsiderationsScalability Considerations
Scalability ConsiderationsNavid Malek
 
No sql databases
No sql databases No sql databases
No sql databases Ankit Dubey
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQLbalwinders
 
NoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, ImplementationsNoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, ImplementationsFirat Atagun
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesJon Meredith
 

Similar to MongoDB (20)

No sq lv1_0
No sq lv1_0No sq lv1_0
No sq lv1_0
 
Master.pptx
Master.pptxMaster.pptx
Master.pptx
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overview
 
Altoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applicationsAltoros using no sql databases for interactive_applications
Altoros using no sql databases for interactive_applications
 
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...Big Data Storage Concepts from the "Big Data concepts Technology and Architec...
Big Data Storage Concepts from the "Big Data concepts Technology and Architec...
 
NoSQL.pptx
NoSQL.pptxNoSQL.pptx
NoSQL.pptx
 
The Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb ClusterThe Care + Feeding of a Mongodb Cluster
The Care + Feeding of a Mongodb Cluster
 
Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
 
Database Technologies
Database TechnologiesDatabase Technologies
Database Technologies
 
NoSQLDatabases
NoSQLDatabasesNoSQLDatabases
NoSQLDatabases
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud Computing
 
Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?Why no sql ? Why Couchbase ?
Why no sql ? Why Couchbase ?
 
MongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of viewMongoDB vs Mysql. A devops point of view
MongoDB vs Mysql. A devops point of view
 
Scalability Considerations
Scalability ConsiderationsScalability Considerations
Scalability Considerations
 
No sql databases
No sql databases No sql databases
No sql databases
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
NoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, ImplementationsNoSQL Introduction, Theory, Implementations
NoSQL Introduction, Theory, Implementations
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL Databases
 

Recently uploaded

9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhidelhimodel235
 
Neelam 9058824046 Call Girls Service in Haridwar
Neelam 9058824046 Call Girls Service in HaridwarNeelam 9058824046 Call Girls Service in Haridwar
Neelam 9058824046 Call Girls Service in Haridwarjaanseema653
 
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️soniya singh
 
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️soniya singh
 
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -Pooja Nehwal
 
Mushkan 8126941651 Call Girls Servicein Jammu
Mushkan 8126941651 Call Girls Servicein JammuMushkan 8126941651 Call Girls Servicein Jammu
Mushkan 8126941651 Call Girls Servicein Jammujaanseema653
 
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012Mona Rathore
 
Sakshi 9058824046 Call Girls Service in Kanpur
Sakshi 9058824046 Call Girls Service in KanpurSakshi 9058824046 Call Girls Service in Kanpur
Sakshi 9058824046 Call Girls Service in Kanpurjaanseema653
 
AliExpress Clothing Brand Media Planning
AliExpress Clothing Brand Media PlanningAliExpress Clothing Brand Media Planning
AliExpress Clothing Brand Media Planningjen_giacalone
 
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Dubai Call Girls O528786472 Call Girls Dubai OL
Dubai Call Girls O528786472 Call Girls Dubai OLDubai Call Girls O528786472 Call Girls Dubai OL
Dubai Call Girls O528786472 Call Girls Dubai OLhf8803863
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhisoniya singh
 
Moscow City People project Roman Kurganov
Moscow City People project Roman KurganovMoscow City People project Roman Kurganov
Moscow City People project Roman KurganovRomanKurganov
 
Call Girls in Sarita Vihar__ 8448079011 Escort Service in Delhi
Call Girls in Sarita Vihar__ 8448079011 Escort Service in DelhiCall Girls in Sarita Vihar__ 8448079011 Escort Service in Delhi
Call Girls in Sarita Vihar__ 8448079011 Escort Service in DelhiRaviSingh594208
 
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar HealthywayAmit Kakkar Healthyway
 
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USAQueen of Hearts Jewelry
 
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy Girls
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy GirlsCall Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy Girls
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy GirlsPooja Nehwal
 
Independent Call Girls Delhi ~9711199012~ Call Me
Independent Call Girls Delhi ~9711199012~ Call MeIndependent Call Girls Delhi ~9711199012~ Call Me
Independent Call Girls Delhi ~9711199012~ Call MeMs Riya
 
My Personal Testimony - James Eugene Barbush - March 11, 2024
My Personal Testimony - James Eugene Barbush - March 11, 2024My Personal Testimony - James Eugene Barbush - March 11, 2024
My Personal Testimony - James Eugene Barbush - March 11, 2024JAMES EUGENE BARBUSH
 

Recently uploaded (20)

9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi
9990771857 Call Girls in Noida Sector 05 Noida (Call Girls) Delhi
 
Neelam 9058824046 Call Girls Service in Haridwar
Neelam 9058824046 Call Girls Service in HaridwarNeelam 9058824046 Call Girls Service in Haridwar
Neelam 9058824046 Call Girls Service in Haridwar
 
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️
Call Girls in civil lines Delhi 8264348440 ✅ call girls ❤️
 
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️
Call Girls in mahipalpur Delhi 8264348440 ✅ call girls ❤️
 
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -
Mumbai Call Girls Malad West WhatsApp 9892124323 Full Night Enjoy -
 
Mushkan 8126941651 Call Girls Servicein Jammu
Mushkan 8126941651 Call Girls Servicein JammuMushkan 8126941651 Call Girls Servicein Jammu
Mushkan 8126941651 Call Girls Servicein Jammu
 
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012
Russian BINDASH Call Girls In Mahipalpur Delhi ☎️9711199012
 
Sakshi 9058824046 Call Girls Service in Kanpur
Sakshi 9058824046 Call Girls Service in KanpurSakshi 9058824046 Call Girls Service in Kanpur
Sakshi 9058824046 Call Girls Service in Kanpur
 
AliExpress Clothing Brand Media Planning
AliExpress Clothing Brand Media PlanningAliExpress Clothing Brand Media Planning
AliExpress Clothing Brand Media Planning
 
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Chittaranjan Park Delhi 💯Call Us 🔝8264348440🔝
 
Dubai Call Girls O528786472 Call Girls Dubai OL
Dubai Call Girls O528786472 Call Girls Dubai OLDubai Call Girls O528786472 Call Girls Dubai OL
Dubai Call Girls O528786472 Call Girls Dubai OL
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Bhikaji Cama Palace | Delhi
 
Moscow City People project Roman Kurganov
Moscow City People project Roman KurganovMoscow City People project Roman Kurganov
Moscow City People project Roman Kurganov
 
Call Girls in Sarita Vihar__ 8448079011 Escort Service in Delhi
Call Girls in Sarita Vihar__ 8448079011 Escort Service in DelhiCall Girls in Sarita Vihar__ 8448079011 Escort Service in Delhi
Call Girls in Sarita Vihar__ 8448079011 Escort Service in Delhi
 
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway
10 Tips To Be More Disciplined In Life To Be Successful | Amit Kakkar Healthyway
 
Rohini Sector 24 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 24 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 24 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 24 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA
22K Indian Gold Jewelry Online - Buy 22 Karat Gold Jewelry in USA
 
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy Girls
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy GirlsCall Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy Girls
Call Girls In Vashi Call Girls Pooja 📞 9892124323 ✅Book Hot And Sexy Girls
 
Independent Call Girls Delhi ~9711199012~ Call Me
Independent Call Girls Delhi ~9711199012~ Call MeIndependent Call Girls Delhi ~9711199012~ Call Me
Independent Call Girls Delhi ~9711199012~ Call Me
 
My Personal Testimony - James Eugene Barbush - March 11, 2024
My Personal Testimony - James Eugene Barbush - March 11, 2024My Personal Testimony - James Eugene Barbush - March 11, 2024
My Personal Testimony - James Eugene Barbush - March 11, 2024
 

MongoDB

  • 2. MongoDB Overview • From “humongous” • Document-oriented database, not relational • Schema free • Manages hierarchical collection of BSON (bee-son) documents • Written in C++ • Has an official driver for C# with support from 10gen • Scalable with high-performance (scales horizontally) • Designed to address today’s workloads • BASE rather than ACID compliant • Replication • Part of the “NoSQL” class of DBMS • Website with list of all features - http://www.mongodb.org/
  • 3. What is NoSQL? • Class of DBMS that differ from relational model • Do not expose the standard SQL interface • May not require fixed table schemas, usually avoid join operations, and typically scale horizontally. • Term coined by Carlo Strozzi in 1998 to name his lightweight, open-source relational database that did not expose the standard SQL interface. • However as Strozzi said, because the current NoSQL movement is departing “from the relational model altogether; it should therefore have been called more appropriately 'NoREL', or something to that effect.“ • http://nosql-database.org/ for examples.
  • 4. Why are these interesting? • New requirements are arising in environments where we have higher volumes of data with high operation rates, agile development and cloud computing. This reflects the growing interactivity of applications which are becoming more networked and social, driving more requests to the database where high-performance DBMS such as MongoDB become favorable. • Not requiring a schema or migration scripts before you add data makes it fit well with agile development approaches. Each time you complete new features, the schema of your database often needs to change. If the database is large, this can mean a slow process.
  • 5. ACID • Relational databases make the ACID promise: – Atomicity - a transaction is all or nothing – Consistency - only valid data is written to the database – Isolation - pretend all transactions are happening serially and the data is correct – Durability - what you write is what you get • The problem is ACID can give you too much, it trips you up when you are trying to scale a system across multiple nodes. • Down time is unacceptable so your system needs to be reliable. Reliability requires multiple nodes to handle machine failures. • To make scalable systems that can handle lots and lots of reads and writes you need many more nodes. • Once you try to scale ACID across many machines you hit problems with network failures and delays. The algorithms don't work in a distributed environment at any acceptable speed. http://highscalability.com/drop-acid-and-think-about-data
  • 6. CAP • If you can't have all of the ACID guarantees it turns out you can have two of the following three characteristics: – Consistency - your data is correct all the time. What you write is what you read. – Availability - you can read and write and write your data all the time – Partition Tolerance - if one or more nodes fails the system still works and becomes consistent when the system comes on-line. • In distributed systems, network partitioning is inevitable and must be tolerated, so essential CAP means that we cannot have both consistency and 100% availability. “If the network is broken, your database won’t work.” • However, we do get to pick the definition of “won’t work”. It can either mean down (unavailable) or inconsistent (stale data). http://www.julianbrowne.com/article/viewer/brewers-cap-theorem
  • 7. BASE • The types of large systems based on CAP aren't ACID, they are BASE (ha ha) – Basically Available - system seems to work all the time – Soft State - it doesn't have to be consistent all the time – Eventually Consistent - becomes consistent at some later time • Many companies building big applications build them on CAP and BASE: Google, Yahoo, Facebook, Amazon, eBay, etc. • Amazon popularized the concept of “Eventual Consistency”. Their definition is: the storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value. • A few examples of eventually consistent systems: – Asynchronous master/slave replication on an RDBMS or MongoDB – DNS – memcached in front of mysql, caching reads For more depth and different configuration examples: http://blog.mongodb.org/post/498145601/on-distributed-consistency-part- 2-some-eventual
  • 8. To get an idea..
  • 9. BSON • Stands for Binary JSON • Is a binary encoded serialisation of JSON-like documents. • Like JSON, BSON supports the embedding of documents and arrays within other documents and arrays. BSON also contains extensions that allow representation of data types that are not part of the JSON spec. For example, BSON has a Date type and a BinData type. • The driver performs translation from the language’s “object” (ordered associative array) data representation to BSON, and back: • C#: new BsonDocument("x", 1) Javascript: {x: 1}
  • 10. Querying in MongoDB • The query expression in MongoDB (and other things, such as index key patterns) is represented like JSON objects (BSON). However, the actual verb (e.g. "find") is done in one's regular programming language. • Usually we think of query object as the equivalent of a SQL "WHERE" clause: C#: db[“users"].Find(Query. EQ(“x”, 3)).SetSortOrder(SortBy.Ascending(“y")); // select * from users where x=3 order by x asc; Javascript: db.users.find( {x : 3} ).sort( {y : 1} ); More on ways of creating queries: http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTutorial- FindandFindAsmethods • Note: In MongoDB, just like in an RDBMS, creating appropriate indexes for queries is quite important for performance. • For a quick tutorial using the shell visit http://try.mongodb.org/
  • 11. To insert a document in the collection create an object representing the document and call Insert. The object can be an instance of BsonDocument or of any class that can be successfully serialized as a BSON document. For example: • If you have a class called Book the code might look like: • You can insert more than one document at a time using the InsertBatch method. For example:
  • 12. A Many to Many Association • In a relational DBMS use an intersection table and joins • In MongoDB use either embedding or linking BsonDocument user = new BsonDocument { { "name", "John" }, { "roles", new BsonArray{“Admin”, “User”, “Engineer”}} }; users.Insert(user); //To get all Engineers users.Find(Query.EQ(“roles”,”Engineer”));
  • 13. • Embedding is the nesting of objects and arrays inside a BSON document. Links are references between documents. • There are no joins in MongoDB – distributed joins would be difficult on a 1,000 server cluster. Embedding is a bit like "prejoined" data. Operations within a document are easy for the server to handle; these operations can be fairly rich. Links in contrast must be processed client-side by the application; the application does this by issuing a follow-up query. • Generally, for "contains" relationships between entities, embedding should be chosen. Use linking when not using linking would result in duplication of data. More detail on referencing: http://www.mongodb.org/display/DOCS/Database+References
  • 14. Replication through Replica Sets • Replica sets are a form of asynchronous master/slave replication, adding automatic failover and automatic recovery of member nodes. • A replica set consists of two or more nodes that are copies of each other. (i.e.: replicas) • The replica set automatically elects a primary (master). No one member is intrinsically primary; that is, this is a share-nothing design. • Drivers (and mongos) can automatically detect when a replica set primary changes and will begin sending writes to the new primary. (Also works with sharding) • Replica sets have several common uses (detail in next slide): – Data Redundancy – Automated Failover / High Availability – Distributing read load – Simplify maintenance (compared to "normal" master-slave) – Disaster recovery • http://www.mongodb.org/display/DOCS/Replica+Sets
  • 15. Why Replica Sets • Data Redundancy – Replica sets provide an automated method for storing multiple copies of your data. – Supported drivers allow for the control of "write concerns". This allows for writes to be confirmed by multiple nodes before returning a success message to the client. • Automated Failover – Replica sets will coordinate to have a single primary in a given set. – Supported drivers will recognize the change of a primary within a replica set. • In most cases, this means that the failure of a primary can be handled by the client without any configuration changes. – A correctly configured replica set basically provides a “hot backup”. Recovering from backups is typically very time consuming and can result in data loss. Having an active replica set is generally much faster than working with backups. • Read Scaling – By default, the primary node of a replica set is accessed for all reads and writes. – Most drivers provide a slaveOkay method for identifying that a specific operation can be run on a secondary node. When using slaveOkay, a system can share the read load amongst several nodes. • Maintenance – When performing tasks such as upgrades, backups and compaction, it is typically required to remove a node from service. – Replica sets allow for these maintenance tasks to be performed while operating a production system. As long as the production system can withstand the removal of a single node, then it’s possible to perform a “rolling” upgrade on such things. • Disaster Recovery – Replica sets allows for a “delayed secondary” node. – This node can provide a window for recovering from disastrous events such as: • bad deployments • dropped tables and collections
  • 16. Horizontal Scalability • Rather than buying bigger servers, MongoDB scales by adding additional servers - improvements come in the form of more processors and cores rather than faster processors from packing more CPUs and ram into a server (vertical scaling). • MongoDB easily supports high transaction rate applications because as more servers are added, transactions are distributed across the larger cluster of nodes, which linearly increases database capacity. With this model additional capacity can be added without reaching any limits. • MongoDB achieves this through auto-sharding.
  • 17. Sharding • For applications that outgrow the resources of a single database server, MongoDB can convert to a sharded cluster, automatically managing failover and balancing of nodes, with few or no changes to the original application code. • Each shard consists of one or more servers and stores data using mongod processes (mongod being the core MongoDB database process). In a production situation, each shard will consist of multiple replicated servers per shard to ensure availability and automated failover. The set of servers/mongod process within the shard comprise a replica set. • Sharding offers: – Automatic balancing for changes in load and data distribution – Easy addition of new machines – Scaling out to one thousand nodes – No single points of failure – Automatic failover • http://www.mongodb.org/display/DOCS/Sharding+Introduction
  • 18. Large MongoDB Deployment example 1. One or more shards, each shard holds a portion of the total data (managed automatically). Reads and writes are automatically routed to the appropriate shard(s). Each shard is backed by a replica set – which just holds the data for that shard. A replica set is one or more servers, each holding copies of the same data. At any given time one is primary and the rest are secondaries. If the primary goes down one of the secondaries takes over automatically as primary. All writes and consistent reads go to the primary, and all eventually consistent reads are distributed amongst all the secondaries. 2. Multiple config servers, each one holds a copy of the meta data indicating which data lives on which shard. 3. One or more routers, each one acts as a server for one or more clients. Clients issue queries/updates to a router and the router routes them to the appropriate shard while consulting the config servers. 4. One or more clients, each one is (part of) the user's application and issues commands to a router via the mongo client library (driver) for its language. mongod is the server program (data or config). mongos is the router program.
  • 19.
  • 20.
  • 21. Companies using MongoDB • Just a few here.. • Foursquare – moved over from PostgreSQL • Craigslist – moved over from a large MySQL cluster. Schema changes were taking forever and it wasn’t really relational information. They wanted to be able to add new machines without downtime (which sharding provides) and route around dead machines without clients failing (which replica sets provide). • Sourcefourge – moved over from MySQL. MongoDB is used for back-end storage on the SourceForge front pages, project pages, and download pages for all projects. • The New York Times - using it in a form-building application for photo submissions. Mongo's dynamic schema gives producers the ability to define any combination of custom form fields. • Full list at http://www.mongodb.org/display/DOCS/Production+Deployments
  • 22. Further Resources • Article: Going NoSQL with MongoDB • C# Driver Tutorial • GUI Tool like Management Studio - http://www.mongovue.com/ • 10gen White Paper • http://www.mongodb.com/ • Wikipedia pages for MongoDB, NoSQL etc. • Google Groups mongodb-user and mongodb-csharp