SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Step by Step {author:  “Daisy Li.“, mail: “daisy.li1989@gmail.com”, knowmore: “hexnova.org” }
mongoDB {name: “mongo”, type: “DB”} Got it name from? humongous                              (very big, [= enormous]) Document-oriented storage ? JSON-style documents.(BSON) Dynamic schemas. Scalable, High availability. mongos: automatic sharding replica set: automatic failover Open source GNU Affero General Public License Full Index Support Compound Keys Indexes Background Index Building
Learn mongoDB Try mongoDB Use mongoDB Your mongoDB
Try mongoDB: A Simple Way Using Tiny mongoDB Brower Shell Visit www.mongodb.org => TRY IT OUT
Try mongoDB: Shell Example MongoDB browser shell version: 0.1.0 connecting to random database type "help" for help type "tutorial" to start the tutorial > a = {name: "mongo", type: "DB"} { "name" : "mongo", "type" : "DB" } > db.mycollection.save(a); "ok" > db.mycollection.update({name: "mongo"}, {$set: {license: "AGPL"}}); "ok" > db.mycollection.find();[   {   "name" : "mongo",   "license" : "AGPL",   "type" : "DB",   "_id" : {   "$oid" : "4c665f61cc937415bd001308"   }   }] >
Use mongoDB: Strong Side Schemaless No need to backup SQL script Available when started Full Index Support RDBMS-style indexes Background index building High Performance Cache disk file
Use mongoDB: Feature Comparatively Consumptive Memory (BSON) Bandwidth (BSON) Disk (BSON) No Transaction Support Consistency cannot be achieved No transaction isolation
Use mongoDB: BSON in Brief {“hello”: “world”} 16000000  length 02  property type hello00  property name 06000000world00  property value 00  a EOF
Use mongoDB: In mongoDB > hexdump –C test.0 00003610  b4 12 73 64 69 64 00 1a  00 00 00 00 00 00 00 12  |..sdid..........| 00003620  66 73 64 69 64 00 b0 8a  23 ee f4 5d 10 a2 12 67  |fsdid...#..]...g| 00003630  72 6f 75 70 49 64 00 e4  4c 6a 09 fe 66 5c 1e 12  |roupId..Lj..f.| 00003640  63 72 65 61 74 65 54 69  6d 65 00 4c 0f 7d 84 6a  |createTime.L.}.j| 00003650  75 f9 3a 12 6c 61 73 74  4d 6f 64 69 66 79 54 69  |u.:.lastModifyTi| 00003660  6d 65 00 4b 81 97 39 14  b0 e6 18 10 64 65 6c 46  |me.K..9.....delF| 00003670  6c 61 67 00 2a d8 25 11  10 67 72 6f 75 70 54 79  |lag.*.%..groupTy| 00003680  70 65 00 6a 1d fc 3b 00  9c 00 00 00 00 26 00 00  |pe.j..;......&..| 00003690  24 37 00 00 ec 35 00 00  8c 00 00 00 07 5f 69 64  |$7...5......._id| 000036a0  00 4c 74 dd 0a a2 77 3d  23 70 c7 3f b4 12 73 64  |.Lt...w=#p.?..sd| 000036b0  69 64 00 1b 00 00 00 00  00 00 00 12 66 73 64 69  |id..........fsdi| 000036c0  64 00 32 b0 15 e8 a8 0d  4f 07 12 67 72 6f 75 70  |d.2.....O..group| 000036d0  49 64 00 e6 2c c8 c0 f6  b2 d4 7f 12 63 72 65 61  |Id..,.......crea| 000036e0  74 65 54 69 6d 65 00 d9  13 13 e5 98 05 1c 01 12  |teTime..........| 000036f0  6c 61 73 74 4d 6f 64 69  66 79 54 69 6d 65 00 7d  |lastModifyTime.}| 00003700  07 b9 d0 32 f8 46 f2 10  64 65 6c 46 6c 61 67 00  |...2.F..delFlag.| 00003710  25 5a 9e 20 10 67 72 6f  75 70 54 79 70 65 00 5e  |%Z. .groupType.^| 00003720  48 ba 3a 00 9c 00 00 00  00 26 00 00 c0 37 00 00  |H.:......&...7..| 00003730  88 36 00 00 8c 00 00 00  07 5f 69 64 00 4c 74 dd  |.6......._id.Lt.| 00003740  0a a2 77 3d 23 71 c7 3f  b4 12 73 64 69 64 00 1c  |..w=#q.?..sdid..|
Use mongoDB: HA & Scalable
Use mongoDB: Attention Manipulation result not returned Get last error after every operation Server-side cursor If used, read till the last record of a query result or kill the cursor. Take whole control of cursor.
Your mongoDB: Capacity Planning How about the performance of your server? (memorypuandwidthisk…) The size of your record? (not your origin object size, but the BSON object size) How much records do you want to hold on single server? (now? future?) TPS under different operations? (insertelect…)
Your mongoDB: Code Tuning Learn to use several tools (SConstructS2010macs…). Analyze source code.  Debug it. Find the bottleneck and the codes related. Modify as less as possible. Recompile and retest.
Your mongoDB: Amoeba for mongoDB mongos’ssharding is based on chunk. A chunk represent a range of records. In most cases, IDs cannot be sharded horizontally in this way. 8298701 149809762 1987093 0 4032987 7298610 11098726 DB1 DB2 DB3
Your mongoDB: Amoeba for mongoDB Like Amoeba for MySQL, Amoeba for mongoDB will provide full control of sharding rules.(by hashangeunction… horizontallyvertically) Better failover. Write multiple copy of data to several nodes. (instead of replication)
Step by Step Thank you! {author:  “Daisy Li.“, mail: “daisy.li1989@gmail.com”, knowmore: “hexnova.org” }

Weitere ähnliche Inhalte

Ähnlich wie 2010-08-26-mongodb-step-by-step-by-hexnova

Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupBadoo Development
 
最小 Hello World! チャレンジ
最小 Hello World! チャレンジ最小 Hello World! チャレンジ
最小 Hello World! チャレンジTakashi Kawachi
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!Daniel Cousineau
 
Behind the scenes with IOS security
Behind the scenes with IOS securityBehind the scenes with IOS security
Behind the scenes with IOS securityPriyanka Aash
 
What's new in Redis v3.2
What's new in Redis v3.2What's new in Redis v3.2
What's new in Redis v3.2Itamar Haber
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performancesource{d}
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBMongoDB
 
Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존동수 장
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Sandesh Rao
 
Java bytecode Malware Analysis
Java bytecode Malware AnalysisJava bytecode Malware Analysis
Java bytecode Malware AnalysisBrian Baskin
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badooMarko Kevac
 
Sandboxie process isolation with kernel hooks
Sandboxie process isolation with kernel hooksSandboxie process isolation with kernel hooks
Sandboxie process isolation with kernel hooksKarlFrank99
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON
 
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation FrameworkConceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation FrameworkMongoDB
 
nullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsnullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsn|u - The Open Security Community
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityMongoDB
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemAcquia
 

Ähnlich wie 2010-08-26-mongodb-step-by-step-by-hexnova (20)

Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
Undrop for InnoDB
Undrop for InnoDBUndrop for InnoDB
Undrop for InnoDB
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
最小 Hello World! チャレンジ
最小 Hello World! チャレンジ最小 Hello World! チャレンジ
最小 Hello World! チャレンジ
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
Behind the scenes with IOS security
Behind the scenes with IOS securityBehind the scenes with IOS security
Behind the scenes with IOS security
 
What's new in Redis v3.2
What's new in Redis v3.2What's new in Redis v3.2
What's new in Redis v3.2
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
Back to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDBBack to Basics, webinar 2: La tua prima applicazione MongoDB
Back to Basics, webinar 2: La tua prima applicazione MongoDB
 
Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존Java/Spring과 Node.js의공존
Java/Spring과 Node.js의공존
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020
 
Java bytecode Malware Analysis
Java bytecode Malware AnalysisJava bytecode Malware Analysis
Java bytecode Malware Analysis
 
marko_go_in_badoo
marko_go_in_badoomarko_go_in_badoo
marko_go_in_badoo
 
Sandboxie process isolation with kernel hooks
Sandboxie process isolation with kernel hooksSandboxie process isolation with kernel hooks
Sandboxie process isolation with kernel hooks
 
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
 
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation FrameworkConceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
 
nullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bitsnullcon 2011 - Memory analysis – Looking into the eye of the bits
nullcon 2011 - Memory analysis – Looking into the eye of the bits
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 
Optimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and CreativityOptimizing Slow Queries with Indexes and Creativity
Optimizing Slow Queries with Indexes and Creativity
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid Them
 

2010-08-26-mongodb-step-by-step-by-hexnova

  • 1. Step by Step {author: “Daisy Li.“, mail: “daisy.li1989@gmail.com”, knowmore: “hexnova.org” }
  • 2. mongoDB {name: “mongo”, type: “DB”} Got it name from? humongous (very big, [= enormous]) Document-oriented storage ? JSON-style documents.(BSON) Dynamic schemas. Scalable, High availability. mongos: automatic sharding replica set: automatic failover Open source GNU Affero General Public License Full Index Support Compound Keys Indexes Background Index Building
  • 3. Learn mongoDB Try mongoDB Use mongoDB Your mongoDB
  • 4. Try mongoDB: A Simple Way Using Tiny mongoDB Brower Shell Visit www.mongodb.org => TRY IT OUT
  • 5. Try mongoDB: Shell Example MongoDB browser shell version: 0.1.0 connecting to random database type "help" for help type "tutorial" to start the tutorial > a = {name: "mongo", type: "DB"} { "name" : "mongo", "type" : "DB" } > db.mycollection.save(a); "ok" > db.mycollection.update({name: "mongo"}, {$set: {license: "AGPL"}}); "ok" > db.mycollection.find();[   {   "name" : "mongo",   "license" : "AGPL",   "type" : "DB",   "_id" : {   "$oid" : "4c665f61cc937415bd001308"   }   }] >
  • 6. Use mongoDB: Strong Side Schemaless No need to backup SQL script Available when started Full Index Support RDBMS-style indexes Background index building High Performance Cache disk file
  • 7. Use mongoDB: Feature Comparatively Consumptive Memory (BSON) Bandwidth (BSON) Disk (BSON) No Transaction Support Consistency cannot be achieved No transaction isolation
  • 8. Use mongoDB: BSON in Brief {“hello”: “world”} 16000000  length 02  property type hello00  property name 06000000world00  property value 00  a EOF
  • 9. Use mongoDB: In mongoDB > hexdump –C test.0 00003610 b4 12 73 64 69 64 00 1a 00 00 00 00 00 00 00 12 |..sdid..........| 00003620 66 73 64 69 64 00 b0 8a 23 ee f4 5d 10 a2 12 67 |fsdid...#..]...g| 00003630 72 6f 75 70 49 64 00 e4 4c 6a 09 fe 66 5c 1e 12 |roupId..Lj..f.| 00003640 63 72 65 61 74 65 54 69 6d 65 00 4c 0f 7d 84 6a |createTime.L.}.j| 00003650 75 f9 3a 12 6c 61 73 74 4d 6f 64 69 66 79 54 69 |u.:.lastModifyTi| 00003660 6d 65 00 4b 81 97 39 14 b0 e6 18 10 64 65 6c 46 |me.K..9.....delF| 00003670 6c 61 67 00 2a d8 25 11 10 67 72 6f 75 70 54 79 |lag.*.%..groupTy| 00003680 70 65 00 6a 1d fc 3b 00 9c 00 00 00 00 26 00 00 |pe.j..;......&..| 00003690 24 37 00 00 ec 35 00 00 8c 00 00 00 07 5f 69 64 |$7...5......._id| 000036a0 00 4c 74 dd 0a a2 77 3d 23 70 c7 3f b4 12 73 64 |.Lt...w=#p.?..sd| 000036b0 69 64 00 1b 00 00 00 00 00 00 00 12 66 73 64 69 |id..........fsdi| 000036c0 64 00 32 b0 15 e8 a8 0d 4f 07 12 67 72 6f 75 70 |d.2.....O..group| 000036d0 49 64 00 e6 2c c8 c0 f6 b2 d4 7f 12 63 72 65 61 |Id..,.......crea| 000036e0 74 65 54 69 6d 65 00 d9 13 13 e5 98 05 1c 01 12 |teTime..........| 000036f0 6c 61 73 74 4d 6f 64 69 66 79 54 69 6d 65 00 7d |lastModifyTime.}| 00003700 07 b9 d0 32 f8 46 f2 10 64 65 6c 46 6c 61 67 00 |...2.F..delFlag.| 00003710 25 5a 9e 20 10 67 72 6f 75 70 54 79 70 65 00 5e |%Z. .groupType.^| 00003720 48 ba 3a 00 9c 00 00 00 00 26 00 00 c0 37 00 00 |H.:......&...7..| 00003730 88 36 00 00 8c 00 00 00 07 5f 69 64 00 4c 74 dd |.6......._id.Lt.| 00003740 0a a2 77 3d 23 71 c7 3f b4 12 73 64 69 64 00 1c |..w=#q.?..sdid..|
  • 10. Use mongoDB: HA & Scalable
  • 11. Use mongoDB: Attention Manipulation result not returned Get last error after every operation Server-side cursor If used, read till the last record of a query result or kill the cursor. Take whole control of cursor.
  • 12. Your mongoDB: Capacity Planning How about the performance of your server? (memorypuandwidthisk…) The size of your record? (not your origin object size, but the BSON object size) How much records do you want to hold on single server? (now? future?) TPS under different operations? (insertelect…)
  • 13. Your mongoDB: Code Tuning Learn to use several tools (SConstructS2010macs…). Analyze source code. Debug it. Find the bottleneck and the codes related. Modify as less as possible. Recompile and retest.
  • 14. Your mongoDB: Amoeba for mongoDB mongos’ssharding is based on chunk. A chunk represent a range of records. In most cases, IDs cannot be sharded horizontally in this way. 8298701 149809762 1987093 0 4032987 7298610 11098726 DB1 DB2 DB3
  • 15. Your mongoDB: Amoeba for mongoDB Like Amoeba for MySQL, Amoeba for mongoDB will provide full control of sharding rules.(by hashangeunction… horizontallyvertically) Better failover. Write multiple copy of data to several nodes. (instead of replication)
  • 16. Step by Step Thank you! {author: “Daisy Li.“, mail: “daisy.li1989@gmail.com”, knowmore: “hexnova.org” }