Hey Asya,
First of all, thanks for your help.
It is surprising for me thast 500ms is horribly slow response time becaue all the queries which i am running from our webapp on mongodb takes at-list 100-150 ms so my question is what i can do to achieve 5-10 ms of response time?
For your reference please see below information and the test which i run on the server.
My all the collections of db are indexed and i have enough memory on the server. i forgot to mention in the last post that mongodb is consuming too much cpu but not memory. i had enough free memory on the server when cpu load was too high,
Here i am showing you the query which is taking 10-13 second to get execute.
At first i executed free -m command to check how much free memory i have.
I had 1.5 gb of free memory available on my server.
then i started mongstat command before directly executing the query on my db.
then i executed the query which takes the most time on my db and i executed the query with explain().
db.queue_sociallinks.find( {"flag":"","uid":"","facebook":"","twitter":"","linkedin":""}, [] ).sort( {"name":1} ).limit( 50 ).skip( 0 ).explain()
and query took 11.514 second to get execute and the output of the query is attached with this post.
And mongostats was showing below stats when this query was running on the server.
insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 351m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:48
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 365m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:49
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 375m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:50
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 384m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:51
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 393m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:52
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 402m 0 mobapi:0.0% 0 0|0 1|0 62b 3k 5 18:46:53
1 6 *0 *0 0 34|0 0 8.18g 16.7g 411m 0 mobapi:0.0% 0 0|0 1|0 4k 8k 6 18:46:54
5 12 *0 *0 0 68|0 0 8.18g 16.7g 418m 0 mobapi:0.2% 0 0|0 1|0 10k 13k 5 18:46:55
insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 mobapi:2.6% 0 0|0 0|0 236b 6k 5 18:46:56
*0 *0 *0 *0 0 3|0 0 8.18g 16.7g 394m 0 test:0.0% 0 0|0 0|0 176b 3k 5 18:46:57
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 mobapi:0.0% 0 0|0 0|0 62b 3k 5 18:46:58
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 test:0.0% 0 0|0 0|0 62b 3k 5 18:46:59
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 test:0.0% 0 0|0 0|0 62b 3k 5 18:47:00
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 test:0.0% 0 0|0 0|0 62b 3k 5 18:47:01
*0 *0 *0 *0 0 1|0 0 8.18g 16.7g 394m 0 test:0.0% 0 0|0 0|0 62b 3k 5 18:47:02
1 5 *0 *0 0 27|0 1 8.18g 16.7g 395m 0 mobapi:0.0% 0 0|0 1|0 3k 7k 6 18:47:03
And this output is showing that there wasn't any page fault, it means the query was definitely fetching data from memory.
So what you think what could be the root cause of high cou load and very slow query response time.
Please let me know if you need any additional detail.
Thanks.
Chint.
On Sunday, August 3, 2014 7:05:10 PM UTC+5:30, Asya Kamsky wrote:
i already mentioned this in the other thread but 500ms is horribly slow response time - and 10 seconds is way out there - I'm guessing you don't have optimal indexes for your queries. You already looked in the logs to see the long running queries, can you include some examples? I suspect they involve in memory sorts or no indexes or both.
Asya
Hello,
I am using mongodb as a db server for one of my php web-application, my websites is deployed on amazon m3.medium instance (VCPU count:-1, RAM:- 1
3.75 GiB) and i am using MongoDB shell version: 2.6.1 and it's a standalone instance.
Now when approx 50-60 users browse my website then cpu load of my instance goes too high when i check the cpu utilization it show me below output.
cat /proc/loadavg
35.03 32.07 36.23
And when i check which process is consuming the highest cpu then it shows
ps auxww --sort=-pcpu|head -20
mongod 4082 62.9 20.5 17521116 110368 ? Sl 11:59 14:26 /usr/bin/mongod -f /etc/mongod.conf
it means mongodb is consuming the highest cpu and when i check the response time of queries then it shows that all the queries are taking only 500-700 ms to get execute except some queries which takes 10-11 seconds.
so If all the queries are smooth then why mongodb is consuming too much of cpu and my site is responding extremely slow and sometimes even i don't get response.
is there any way to find out which mongodb component or which mongodb query is consuming the highest cpu so i can fix that issue.
Note:- memory utilization is not high when always 1-1.5 gb of memory is free on the server.
Best,
Chint.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.