Putting the Go in MongoDB: How We Rebuilt The MongoDB Tools in Go

download Putting the Go in MongoDB: How We Rebuilt The MongoDB Tools in Go

If you can't read please download the document

Transcript of Putting the Go in MongoDB: How We Rebuilt The MongoDB Tools in Go

  1. 1. Putting the Go in MongoDB Wisdom Omuya Software Engineer [email protected]
  2. 2. MongoDB v3.0.0
  3. 3. WHAT TOOLS? tools
  4. 4. downloads.mongodb.org
  5. 5. Import mongofiles
  6. 6. Export
  7. 7. Monitoring mongostat mongotop
  8. 8. Others bsondump mongooplog
  9. 9. ROUGH EDGES tools
  10. 10. Mongorestore Concurrency in 2.6
  11. 11. Invalid Documents Nested CSV, TSV imports { "_id": ObjectId("5542593837096bdf8bbb6d91"), name.first: Wisdom, name.last: Omuya" } name.first,name.last Wisdom,Omuya
  12. 12. mongo> db.test.find({name.first":Wisdom"}) Fetched 0 record(s) in 0ms Unretrievable Data { "_id": ObjectId("5542593837096bdf8bbb6d91"), name.first: Wisdom, name.last: Omuya" }
  13. 13. REQUIREMENTS tools
  14. 14. Loose Coupling
  15. 15. Shorter Release Cycle
  16. 16. Portability
  17. 17. Concurrent Processing CPU
  18. 18. General Storage engine support Wiredtiger, RocksDB, etc Backwards compatibility Dump and restore BSON Import and export JSON
  19. 19. Excellent support for concurrency Runs on all supported platforms Easier to write and debug Fun! Why Go?
  20. 20. MONGOIMPORT tools
  21. 21. mongoimport
  22. 22. Mongoimport Architecture
  23. 23. New Mongoimport Flags --numDecodingWorkers (autodetect to max) --numInsertionWorkers (default 1) --batchSize (default 10k) --numThreads (autodetect to max) --maintainInsertionOrder (default false)
  24. 24. Input Validation No more broken imports, illegal field names a, b.
  25. 25. Dot-nesting Nested CSV, TSV imports name.first,name.last Wisdom,Omuya { "_id": ObjectId("55425a3c37096bdf8bbb6d93"), "name": { "first": Wisdom", "last": Omuya" } }
  26. 26. Import/Export Type Fidelity
  27. 27. Write Concern Specificity New default w=majority on import/restore/files o safer, matches what our users assume is happening --writeConcern flag e.g. {w: 3, j: true, fsync: false, wtimeout: 400}
  28. 28. Mongoimport Concurrency in 3.0
  29. 29. MONGORESTORE tools
  30. 30. Mongorestore Architecture
  31. 31. New Mongorestore Flags --numParallelCollections (aka -j default=4) --numInsertionWorkersPerCollection (default=1) --batchSize(default 10k) --numThreads (autodetect to max) --maintainInsertionOrder (default false)
  32. 32. Mongorestore Concurrency in 3.0 2X speedup 4X speedup
  33. 33. Whats next? mongorestore and mongodump now support compression and archiving No need for directories containing BSON files mongodump -d weather -h localhost --archive --gzip | mongorestore -h remotehost --archive --gzip
  34. 34. Resources Repository: https://github.com/mongodb/mongo-tools Usage Guide: https://docs.mongodb.org/master/reference/program/ Issue Tracking: https://jira.mongodb.org/browse/tools/
  35. 35. THANKS! tools