Your SlideShare is downloading. ×
0
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
A Brief MongoDB Intro
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

A Brief MongoDB Intro

1,840

Published on

A brief mongodb intro

A brief mongodb intro

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,840
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
36
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. MongoDB <ul><li>The Highly Scalable, Enterprise Grade, Open Source Database </li></ul>
  • 2. NoSQL: A New Era of Databases <ul><li>Big Data, Big Problem </li></ul>Scaling for the Demands of Modern Applications
  • 3. Starting from Scratch <ul><li>10gen as an open source ‘ app engine ’ cloud platform </li></ul><ul><li>Backend storage needs </li></ul><ul><ul><li>Agility </li></ul></ul><ul><ul><li>Scalability </li></ul></ul><ul><ul><li>Feature-richness </li></ul></ul><ul><ul><li>Performance </li></ul></ul><ul><ul><li>Ease of use </li></ul></ul>
  • 4. Agility <ul><li>MongoDB is document-oriented. </li></ul><ul><li>JSON-like objects </li></ul><ul><li>‘ Documents ’ are organized into ‘ Collections ’ </li></ul><ul><li>Schema is not enforced </li></ul>&gt; a = { name: “ mongo ” }; { “ name ” : “ mongo ” } &gt;b = { x : 3 }; { “ x ” : 3 } &gt; c = { x : 4 , j : 1 }; { “ x ” : 4 , “ j ” : 1 } &gt;db.things.save(a) &gt;db.things.save(b) &gt;db.things.save(c) &gt;db.things.find() { &amp;quot;_id&amp;quot; : ObjectId(&amp;quot;4c2209f9f3924d31102bd84a&amp;quot;), &amp;quot;name&amp;quot; : &amp;quot;mongo&amp;quot; } { &amp;quot;_id&amp;quot; : ObjectId(&amp;quot;4c2209fef3924d31102bd84b&amp;quot;), &amp;quot;x&amp;quot; : 3 } { &amp;quot;_id&amp;quot; : ObjectId(&amp;quot;4c220a42f3924d31102bd856&amp;quot;), &amp;quot;x&amp;quot; : 4, &amp;quot;j&amp;quot; : 1 }
  • 5. Deep Data <ul><ul><li>{ _id : ObjectId(&amp;quot;4c4ba5c0672c685e5e8aabf3&amp;quot;), </li></ul></ul><ul><ul><li>author : ” roger&amp;quot;, </li></ul></ul><ul><ul><li>date : &amp;quot;Sat Jul 24 2010 19:47:11 GMT-0700 (PDT)&amp;quot;, </li></ul></ul><ul><ul><li>text : &amp;quot; I love J.Biebs... &amp;quot;, </li></ul></ul><ul><ul><li>tags : [ ” rockstar&amp;quot;, ” puppy-love&amp;quot; ], </li></ul></ul><ul><ul><li>comments_count: 1, </li></ul></ul><ul><ul><li>comments : [ </li></ul></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>author : ” Gretchen&amp;quot;, </li></ul></ul><ul><ul><li>date : &amp;quot;Sat Jul 24 2010 20:51:03 GMT-0700 (PDT)&amp;quot;, </li></ul></ul><ul><ul><li>text : ” Biebs is Toll!!!!&amp;quot; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>]} </li></ul></ul>
  • 6. Replication <ul><li>Replication for high availability </li></ul><ul><li>Replica Sets </li></ul><ul><ul><li>Auto-failover </li></ul></ul><ul><ul><li>Primary fails, secondary elected primary </li></ul></ul><ul><ul><li>Primary repaired, becomes secondary </li></ul></ul><ul><li>Single-write node </li></ul><ul><li>Great for higher read volume </li></ul>
  • 7. Replication Primary Secondary Secondary Secondary Secondary Client
  • 8. Scalability <ul><li>MongoDB features autosharding for horizontal scalability </li></ul>mongod mongod mongod mongos mongod mongod mongod Config Servers Shard Shard Shard Client
  • 9. Sharding with Replica Sets mongod mongos mongod mongod mongod Config Servers Shard Shard Shard mongod mongod mongod mongod mongod mongod mongod mongod Client
  • 10. Performance <ul><li>Data Model </li></ul><ul><ul><li>Dynamic </li></ul></ul><ul><ul><li>Deep data </li></ul></ul><ul><li>In-place updates </li></ul><ul><li>Simplicity </li></ul>
  • 11. Performance <ul><li>milancermak.posterous.com </li></ul>
  • 12. Performance <ul><li>MongoDB test results: </li></ul><ul><li>siege -f ./stress_urls.txt -c 300 -r 10 -d1 -i </li></ul><ul><li>Transactions: 2994 hits </li></ul><ul><li>Availability: 99.80 % </li></ul><ul><li>Elapsed time: 11.95 secs </li></ul><ul><li>Data transferred: 3.19 MB </li></ul><ul><li>Response time: 0.26 secs </li></ul><ul><li>Transaction rate: 250.54 trans/sec </li></ul><ul><li>Throughput: 0.27 MB/sec </li></ul><ul><li>Concurrency: 65.03 </li></ul><ul><li>Successful transactions: 2994 </li></ul><ul><li>Failed transactions: 6 </li></ul><ul><li>Longest transaction: 1.47 </li></ul><ul><li>Shortest transaction: 0.00 </li></ul><ul><ul><ul><ul><ul><li>MySQL test results: </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>siege -f ./stress_urls_mysql.txt -c 300 -r 10 -d1 -i </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Transactions: 2832 hits </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Availability: 94.40 % </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Elapsed time: 23.53 secs </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Data transferred: 2.59 MB </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Response time: 0.74 secs </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Transaction rate: 120.36 trans/sec </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Throughput: 0.11 MB/sec </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Concurrency: 89.43 </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Successful transactions: 2832 </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Failed transactions: 168 </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Longest transaction: 16.36 </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Shortest transaction: 0.00 </li></ul></ul></ul></ul></ul>obvioushints.blogspot.com
  • 13. Performance <ul><li>bcbio.wordpress.com </li></ul>
  • 14. Recent MongoDB Conferences
  • 15. MongoDB Downloads
  • 16. Production + Deployments
  • 17. Thank you @mongodb [email_address] ; adam@10gen.com Mongo France, March 23 MongoSF, May 24 http://www.10gen.com/events http://bit.ly/mongofb Facebook | Twitter | LinkedIn http://linkd.in/joinmongo download at mongodb.org
  • 18. (SQL vs MongoDB) <ul><li>SQL Statement </li></ul><ul><li>Mongo Query Language Statement </li></ul><ul><li>CREATE TABLE USERS (a Number, b Number) </li></ul><ul><li>implicit; can be done explicitly </li></ul><ul><li>INSERT INTO USERS VALUES(1,1) </li></ul><ul><li>db.users.insert({a:1,b:1}) </li></ul><ul><li>SELECT a,b FROM users </li></ul><ul><li>db.users.find({}, {a:1,b:1}) </li></ul><ul><li>SELECT * FROM users </li></ul><ul><li>db.users.find() </li></ul><ul><li>SELECT * FROM users WHERE age=33 </li></ul><ul><li>db.users.find({age:33}) </li></ul><ul><li>SELECT a,b FROM users WHERE age=33 </li></ul><ul><li>db.users.find({age:33}, {a:1,b:1}) </li></ul><ul><li>SELECT * FROM users WHERE age=33 ORDER BY name </li></ul><ul><li>db.users.find({age:33}).sort({name:1}) </li></ul><ul><li>SELECT * FROM users WHERE age&gt;33 </li></ul><ul><li>db.users.find({&apos;age&apos;:{$gt:33}})}) </li></ul><ul><li>SELECT * FROM users WHERE age&lt;33 </li></ul><ul><li>db.users.find({&apos;age&apos;:{$lt:33}})}) </li></ul><ul><li>SELECT * FROM users WHERE name LIKE &amp;quot;%Joe%&amp;quot; </li></ul><ul><li>db.users.find({name:/Joe/}) </li></ul><ul><li>SELECT * FROM users WHERE name LIKE &amp;quot;Joe%&amp;quot; </li></ul><ul><li>db.users.find({name:/^Joe/}) </li></ul>CREATE INDEX myindexname ON users(name,ts DESC) db.users.ensureIndex({name:1,ts:-1}) SELECT * FROM users WHERE a=1 and b=&apos;q&apos; db.users.find({a:1,b:&apos;q&apos;}) SELECT * FROM users LIMIT 10 SKIP 20 db.users.find().limit(10).skip(20) SELECT * FROM users WHERE a=1 or b=2 db.users.find( { $or : [ { a : 1 } , { b : 2 } ] } ) SELECT * FROM users LIMIT 1 db.users.findOne() EXPLAIN SELECT * FROM users WHERE z=3 db.users.find({z:3}).explain() SELECT DISTINCT last_name FROM users db.users.distinct(&apos;last_name&apos;) SELECT COUNT(*y) FROM users db.users.count() SELECT COUNT(*y) FROM users where AGE &gt; 30 db.users.find({age: {&apos;$gt&apos;: 30}}).count()

×