Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

4 Database Landscape

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

12 Reliability – Replica Sets

Slide 13

Slide 13 text

13 Scalability – Auto-sharding

Slide 14

Slide 14 text

14 Relational Schema

Slide 15

Slide 15 text

15 MongoDB Schema

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

18 Official MongoDB Drivers

Slide 19

Slide 19 text

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)

Slide 20

Slide 20 text

Sridhar Nanjundeswaran @snanjund