Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MongoDB Introduction

MongoDB Introduction

Presented at the SF MongoDB/F# meetup

Sridhar Nanjundeswaran

September 04, 2013
Tweet

More Decks by Sridhar Nanjundeswaran

Other Decks in Programming

Transcript

  1. MongoDB – An Introduction
    Sridhar Nanjundeswaran, @snanjund
    MongoDB, Inc.

    View full-size slide

  2. 2
    10Gen is now MongoDB
    280+ employees 500+ customers
    Over $81 million in funding
    Offices in New York, Palo Alto, Washington
    DC, London, Dublin, Barcelona and Sydney

    View full-size slide

  3. 3
    Relational Database Challenges
    Data Types
    • Unstructured data
    • Semi-structured data
    • Polymorphic data
    Volume of Data
    • Petabytes of data
    • Trillions of records
    • Tens of millions of
    queries per second
    Agile Development
    • Iterative
    • Short development
    cycles
    • New workloads
    New Architectures
    • Horizontal scaling
    • Commodity
    servers
    • Cloud computing

    View full-size slide

  4. 4
    Database Landscape

    View full-size slide

  5. 5
    MongoDB is a ___________
    database
    • Document-oriented
    • Open-source
    • High performance and horizontally scalable
    • Full featured

    View full-size slide

  6. 6
    Document-Oriented Database
    • Not .PDF & .DOC files
    • A document is essentially an associative array
    – JSON object, PHP Array, Python Dictionary, etc.
    • BSON – www.bsonspec.org

    View full-size slide

  7. 7
    Open-Source
    • MongoDB is an open-source project
    • On GitHub
    • Database licensed under the AGPL
    • Drivers licensed under Apache

    View full-size slide

  8. 8
    High Performance and
    Horizontally Scalable
    • High performance
    – Written in C++
    – Data serialized as BSON (fast parsing)
    – Full support for primary & secondary indexes
    • Horizontally scalable
    – Auto-sharding
    – Scale across
    • Commodity hardware
    • Cloud compute
    • Hybrid

    View full-size slide

  9. 9
    Full Featured
    • Rich Ad Hoc queries
    • Real time aggregation
    • Geospatial features
    • Native bindings for most programming
    languages

    View full-size slide

  10. 10
    MongoDB is a Single-Master System
    • All writes are to a primary (master)
    • Failure of the primary is detected, and a new one
    is elected
    • Application writes get an error if there is no
    quorum to elect a new master
    – Reads can continue

    View full-size slide

  11. 11
    MongoDB Storage Management
    • Data is kept in memory-mapped files
    • Files are allocated as needed
    • Indexes (B*-trees) point to documents using
    geographical addresses

    View full-size slide

  12. 12
    Reliability – Replica Sets

    View full-size slide

  13. 13
    Scalability – Auto-sharding

    View full-size slide

  14. 14
    Relational Schema

    View full-size slide

  15. 15
    MongoDB Schema

    View full-size slide

  16. 16
    > db.users.findOne()
    {
    "_id" : ObjectId("50804d0bd94ccab2da652599"),
    …,
    ”tag_count” : 2,
    ”tags” : ["superuser", ”dbadmin"],
    "address" : {"street" : "555 University Avenue",
    "city": "Palo Alto”}
    }
    User document

    View full-size slide

  17. 17
    Terminology
    RDBMS Mongo
    Table, View Collection
    Row(s) Document
    Index Index
    Join Embedded
    Document
    Partition Shard
    Partition Key Shard Key

    View full-size slide

  18. 18
    Official MongoDB Drivers

    View full-size slide

  19. 19
    MongoDB drivers
    • Official Support for 13 languages
    • Community drivers for tons more
    – R, lua etc.
    • Drivers connect to mongo servers
    • Drivers translate BSON into native types
    • mongo shell is not a driver, but works like one
    in some ways
    • Installed using typical means (npm, pecl, gem,
    pip)

    View full-size slide

  20. Sridhar Nanjundeswaran
    @snanjund

    View full-size slide