Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Log MongoDB Slow
Query
Pricebook.co.id and MongoDB
●Pricebook.co.id; A shopping search engine, price
comparison website based in Indonesia, launc...
Collecting performance data (1)
●Enable MongoDB profiling
db.setProfilingLevel(1);
Table of profiling level
-1 No change. ...
Collecting performance data (2)
Example : Getting the slow queries below 200 miliseconds
db.setProfilingLevel(1,200);
“Whe...
Collecting performance data (3)
system.profile; Here is one example
document of how it looks.
-what command?
count product...
System.Profile
●MMS (MongoDB Monitoring System) to help you with this
what’s next?
OK, now we know what queries are slow.. and then..
Solutions might be different from one application type and...
Thank you!
@hadiariawan
Upcoming SlideShare
Loading in …5
×

Log MongoDB slow query

1,201 views

Published on

How to log MongoDB slow query?
Analyze Performance of Database Operations

Published in: Technology
  • Be the first to comment

Log MongoDB slow query

  1. 1. Log MongoDB Slow Query
  2. 2. Pricebook.co.id and MongoDB ●Pricebook.co.id; A shopping search engine, price comparison website based in Indonesia, launched on December 2013 ●Fast growing ●Millions and millions of documents ●More than 27GB data size ●…
  3. 3. Collecting performance data (1) ●Enable MongoDB profiling db.setProfilingLevel(1); Table of profiling level -1 No change. Returns the current profile level. 0 Off. No profiling. 1 On. Only includes slow operations. 2 On. Includes all operations. By default slow operations are those slower than 100 milliseconds. You can change to whatever number that suits your platform.
  4. 4. Collecting performance data (2) Example : Getting the slow queries below 200 miliseconds db.setProfilingLevel(1,200); “When you enable profiling, you also set the profiling level. The profiler records data in the system.profile collection. MongoDB creates the system.profile collection in a database after you enable profiling for that database.” Read the complete reference here : http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/
  5. 5. Collecting performance data (3) system.profile; Here is one example document of how it looks. -what command? count product_id on searchindex collection -how long? 110 ms
  6. 6. System.Profile ●MMS (MongoDB Monitoring System) to help you with this
  7. 7. what’s next? OK, now we know what queries are slow.. and then.. Solutions might be different from one application type and another. -Index? -Denormalize? Change schema design? -Scale up? Upgrade machine specs?
  8. 8. Thank you! @hadiariawan

×