[SERVER-10738] Why is my mongodb so slow? Created: 11/Sep/13 Updated: 10/Dec/14 Resolved: 03/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance, Performance, Querying |
| Affects Version/s: | 2.4.1 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | dongweiming | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | performance, query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 12.04.2 LTS 3.5.0-23-generic x86_64 |
||
| Participants: |
| Description |
|
Our company produces environment uses mongodb as a web database, but I found us a simple query or update (with index) will be a few hundred ms time-consuming, and some even more. Was not what we use right? Here is the log part (most of them are like this): Wed Sep 11 16:47:36.187 [conn46044] update sandbox.status_5167852c208eb5a2f1c2b260_201309 query: { _id: "244593027441387" }update: { $set: { rcount: 10, hot: true, ccount: 2 } } nscanned:1 nupdated:1 keyUpdates:0 locks(micros) w:614810 614ms update: { $set: { rsince_timestamp: 1378873552 }, $inc: { sm_flash_factor: 0, repost_count: 0 } } idhack:1 nupdated:1 fastmod:1 keyUpdates:0 locks(micros) w:123 554ms update: { $inc: { nctc: 0 } } nscanned:1 nupdated:1 fastmod:1 keyUpdates:0 locks(micros) w:169 521ms update: { $set: { rcount: 0, hot: false, ccount: 0 } } nscanned:1 nupdated:1 keyUpdates:0 locks(micros) w:397837 397ms update: { $set: { id: "lonestan", city: "", verified: false, activeness: 0.005800625374694182, followers_count: 167, status_created_at: new Date(1251590400000), location: "unkown", province: "31", description: "", friends_count: 1277, tags: {}, profile_image_url: "http://mat1.gtimg.com/www/mb/images/head_50.jpg", sm_flwr_quality: 0.002194834672492721, screen_name: "longes", supdate_time: new Date(1378857600000), favourites_count: 0, name: "lonetan", url: "http://www.google.com/", gender: "m", created_at: new Date(1251590400000) }, $addToSet: { sm_uids: "htcwildfire" }} nscanned:1 nupdated:1 keyUpdates:0 locks(micros) w:446 342ms example the first line. you can see ocks(micros) w:614810 and use 614ms!! this is indexes: , , , > db.status_5167852c208eb5a2f1c2b260_201309.find({_id: "244593027441387"}).explain() , }, the collection has 17384 entry. > db.status_5167852c208eb5a2f1c2b260_201309.find().count() > db.status_5167852c208eb5a2f1c2b260_201309.stats() , |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 03/Oct/13 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
The explain() output you've posted shows the query takes 0 ms. and is using the index properly. There are many things that can cause your query to temporarily perform poorly. This JIRA project is for reporting bugs with mongodb. The user group is a better venue for general questions. https://groups.google.com/forum/#!forum/mongodb-user I recommend using MMS for tracking the health of your mongodb cluster over time and for identifying problems. It's a free service. You can sign in with your JIRA username and password here: http://mms.mongodb.com. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by dongweiming [ 12/Sep/13 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
sorry Our business is not to use a replica set, only a single server. and not in MMS. following a record for mongostat:
By the way. The MMS services can help us find the problem, positioning it? | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by James Wahlin [ 11/Sep/13 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Is your replica set in MMS? If so can you share a link? If not, can you run mongostat while experiencing the slowness and attach the output to this ticket? |