Your SlideShare is downloading. ×
  • Like
Mongo DB
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

Александр Колесень «Mongo DB» …

Александр Колесень «Mongo DB»

Доклдад на майской линуксовке MLUG 2013

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
120
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

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. Hello
  • 2. MongoDB • open-source • document-oriented • json/bson
  • 3. JSON > db.users.findOne() { "_id" : ObjectId("5099803df3f4948bd2f98391"), "name" : { "first" : "Alan", "last" : "Turing" }, "birth" : ISODate("1912-06-22T21:00:00Z"), "death" : ISODate("1954-06-06T21:00:00Z"), "views" : NumberLong(1250000) }
  • 4. _id field > db.users.findOne({}, {_id: 1, name: 1}) { "_id" : ObjectId("5099803df3f4948bd2f98391"), "name" : { "first" : "Alan", "last" : "Turing" } } > ObjectId("509..91").getTimestamp() ISODate("2012-11-06T21:25:17Z")
  • 5. BSON • http://bsonspec.org/#/specification • http://groups.google.com/group/bson
  • 6. Schemaless > db.users.update({_id: ObjectId("509..91")}, { $set: { born: "London, England" }}) > db.users.find({"name.first": "Alan"}) { "_id" : ObjectId("5099803df3f4948bd2f98391"), "birth" : ISODate("1912-06-22T21:00:00Z"), "born" : "London, England", "death" : ISODate("1954-06-06T21:00:00Z"), "name" : { "first" : "Alan", "last" : "Turing" }, "views" : NumberLong(1250000) }
  • 7. Storage • mmap • OS page cache
  • 8. Journal • present • group commit every 100ms, by default (2..300ms)
  • 9. Fault-tolerance PRIMARY> rs.conf() { "_id" : "rs2", "version" : 3, "members" : [ { "_id" : 0, "host" : "10.99.41.134:27017" }, { "_id" : 1, "host" : "10.28.130.177:27017" }, { "_id" : 2, "host" : "10.217.30.225:27017" } ] }
  • 10. Sharding • horizontal partitioning • multiple nodes • ‘config‘ servers, 1 or 3, sync. replication • ‘mongos‘ routers • db.runCommand(addshard: ... ) • db.runCommand(removeshard: ... ) • chunks, 64M, changeable • do it once, do it right • increasing monotonically • so do not shard by _id
  • 11. Locks, etc. • server-wide lock, prior to 2.1 • DB-level lock now • yield on page fault • ext3 fallocate, slow
  • 12. Coursera “Functional Programming Principles in Scala” by Martin Odersky https://class.coursera.org/progfun-002/class/index