O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

mongoDB Performance

3.722 visualizações

Publicada em

Publicada em: Tecnologia
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • 10x Dinesh!
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Good Insight concisely, thanks!
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

mongoDB Performance

  1. 1. The VP R&D Open SeminarMongoDB PerformanceMoshe Kaplanmokplan@gmail.comhttp://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com
  2. 2. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comWho is Using MongoDB?2
  3. 3. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comWho is Behind MongoDB?3
  4. 4. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com4Strategy A - Sharding
  5. 5. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com5Strategy B - In Memory Databases
  6. 6. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com6700 Inserts/SecIn Memory Engine3000 Inserts/SecInnoDB Engine700 Inserts/SecAmazonAWSStandardLargeInstance
  7. 7. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com7Strategy C – MapReducehttp://blogs.microsoft.co.il/blogs/vprnd
  8. 8. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comStrategy D - NoSQLinsertgetmultigetremovetruncate8<Key, Value>http://wiki.apache.org/cassandra/API
  9. 9. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.com9And now…http://www.webperformancetoday.com/2010/06/15/everything-you-wanted-to-know-about-web-performance/
  10. 10. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarMONGODB TUNING10
  11. 11. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comjournalCommitInterval = 300:Write to disk: 2ms <= t <= 300msDefault 100ms, increase to 300ms to saveresourcesDiskThe Journal11MemoryJournal Data1 2
  12. 12. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.commongod.conf TuningmaxConns: # of connection (<20,000)objcheck: BSON validation. false to saveoverhead.nohttpinterface = true: disables http interfacenoprealloc = false: preallocates space @ startupnoscripting = true: disables scripting engineprofile = 0: disable profilingrest = false: disable REST service12
  13. 13. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarSERVER STATS13
  14. 14. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comWhat we are facing of?> db.serverStatus().mem;> db.serverStatus().extra_info;> db.serverStatus().globalLock;> db.serverStatus().backgroundFlushing;> db.serverStatus().connections;> db.serverStatus().network;14RAMPage FaultsLock RatioI/O SpeedNot Too ManyBandwidth
  15. 15. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comRAM OptimizationdataSize + indexSize < RAM15OSData IndexJournal
  16. 16. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarPROFILING AND SLOW LOG16
  17. 17. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comProfiling ConfigurationEnable:• mongod --profile=1 --slowms=15• db.setProfilingLevel([level] , [time])How much:• 0 (none) 1 (slow queries only) 2 (all)• 100ms: defaultWhere:• system.profile collection17
  18. 18. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comProfiling Results AnalysisLast 5 >1ms: show profilew/o commands:db.system.profile.find( { op: { $ne : command } } ).pretty()Specific database:db.system.profile.find( { ns : mydb.test } ).pretty()Slower than:db.system.profile.find( { millis : { $gt : 5 } } ).pretty()Between dates:db.system.profile.find({ts : {$gt : new ISODate("2012-12-09T03:00:00Z") ,$lt : new ISODate("2012-12-09T03:40:00Z")}}).pretty()18
  19. 19. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comExplain> db.courses.find().explain();{ "cursor" : "BasicCursor","isMultiKey" : false,"n" : 11, “nscannedObjects" : 11,"nscanned" : 11, "nscannedObjectsAllPlans" : 11,"nscannedAllPlans" : 11,"scanAndOrder" : false, "indexOnly" : false,"nYields" : 0,"nChunkSkips" : 0,"millis" : 0,"indexBounds" : {},"server" : "primary.domain.com:27017"}19
  20. 20. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarINDEXES20
  21. 21. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comIndex ManagementRegular Indexdb.users.ensureIndex( { user_id: 1 } )Multiple + DESC Indexdb.users.ensureIndex( { user_id: 1, age: -1 } )Sub Document Indexdb.users.ensureIndex( { address.zipcode: 1 } )List Indexesdb.users.getIndexes()Drop Indexesdb.users.dropIndex(“indexName”)21
  22. 22. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comKnown Index IssuesBound filter should be the last(in the index as well).22
  23. 23. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarSTATS &SCHEMA DESIGN23
  24. 24. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comSparse Matrix? I don’t Think somongostat> db.stats();> db.collectionname.stats();Fragmentation if storageSize/size > 2db.collectionanme.runCommand(“compact”)Padding (wrong design) if paddingFactor > 224
  25. 25. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe VP R&D Open SeminarTHE LOCKING DILEMA25
  26. 26. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comLocking on Write (CRUD)2.0 Global Lock2.2 Database Lock2.X …What to do till then?26
  27. 27. http://blogs.microsoft.co.il/blogs/vprndhttp://top-performance.blogspot.comThe Startup Nation Feed27 Join @ InsideMy.co

×