[SERVER-9049] Mongod 2.4.0 takes upto 99 % cpu and query result is undef Created: 21/Mar/13 Updated: 10/Dec/14 Resolved: 01/Apr/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Diagnostics |
| Affects Version/s: | 2.4.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Arati Sethy | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux |
||
| Issue Links: |
|
||||
| Operating System: | Linux | ||||
| Steps To Reproduce: | 1. Run stand alone mongod |
||||
| Participants: | |||||
| Description |
|
Hi All, Process 3284 attached - interrupt to quit My collections are indexed on _id. Can any one help if i am missing something. Thanks |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Using javascript to do a count is going to be slower than the built in count. If you have another operation that is slow, please open a ticket for that specific one. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have tried this . It gives me back result in 3-5 secs. This is like a work around just for count. I have more requirements to aggregate values of a particular filed.(Not part of this collection/query). Question is to reduce CPU cycles and memory usage. Thanks for your immediate response. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you try something like this instead
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am executing below group by command using perl driver run_command . It takes 25-30 secs for each query. I have a requirement of getting whole days aggregated data per hour. I am unable to achieve that functionality with below data size , as the application does 24 queries and each query takes 30 secs to complete. my $cmd_str_month = '{ \'group\' => { \'ns\' => \'apslog\', \'$reduce\' => \'function(doc,out){if (( doc.action_taken == 0 || doc.action_taken == 1 || doc.action_taken == 2 || doc.action_taken == 4 ) &&(doc.timestamp >= $frm_month && doc.timestamp <= $totime) ) { out.count++ ; }}\', \'initial\' => { \'count\' => 0 }, \'key\' => { \'attack_category\' => 1 }} };'; ------------------- > db.apslog.count() > db.apslog.getIndexKeys() , , { "timestamp" : 1, "_id" : 0 }] , , , option to do more thorough scan.", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So the result is ok/correct? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Eliot, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What do you mean query result is undefined? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 28/Mar/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Running this query every 10 mins for 1 day resulted in 20G virtual memory usage. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 26/Mar/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Thomas, , , option to do more thorough scan.", , { "timestamp" : 1, "client_ip" : 1, "client_port" : 1, "application_ip" : 1, "application_port" : 1 }] when i do a query to get count of logs in last week/month CPU spikes to 99.3% and mem usage is 25.9% from top command Below is currentop data and mongostats data } , , } ------------------------------- ------------------------------------- Please help to resolve this problem. I use query every 5 mins to get count of logs for 1 hr, daily/weekly and monthly basis Thanks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Thomas Rueckstiess [ 25/Mar/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Arati, Do you still know the exact syntax of the query you used? We don't have enough information to diagnose the problem at this point. Are you saying the same queries are now running without the increase in CPU%? Is your mongod instance in MMS? Regards, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Arati Sethy [ 22/Mar/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I saw this problem only once. I have mongotop output when it was taking 97% cpu even if i was running no query.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 21/Mar/13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you post the output of running mongotop and a minute or so of mongostat, along with db.currentOp()? Please post the query you are using and the explain output as well: http://docs.mongodb.org/manual/reference/method/cursor.explain/#cursor.explain – this may be easier if done in the javascript mongo shell. |