Mongolian concurrent requests via nodejs

I am trying to run multiple mongodb requests through node Async. But they still take time to launch. The database is indexed and fully optimized. Is there a way by which I can increase the query execution time using the mongodb administrator ... or increase its performance by allocating more memory to it.

Queries are run one after the other when I see on the console. and some of them take too much time ... as a result, there is no answer.

2015-12-29T10:31:48.958-0800 I COMMAND [conn63] command consumers.$cmd command: count { count: "consumer1s", query: { ZIP: 37089, $or: [ { ADULTS_F_18_24: "Y" }, { ADULTS_F_24_35: "Y" } ] } } planSummary: IXSCAN { ZIP: 1.0, GENDER: 1.0 } keyUpdates:0 writeConflicts:0 numYields:1 reslen:44 locks:{ Global: { acquireCount: { r: 4 } }, MMAPV1Journal: { acquireCount: { r: 4 } }, Database: { acquireCount: { r: 2 } }, Collection: { acquireCount: { R: 2 }, acquireWaitCount: { R: 2 }, timeAcquiringMicros: { R: 54270 } } } 146ms 2015-12-29T10:31:54.925-0800 I COMMAND [conn62] command consumers.$cmd command: count { count: "consumer1s", query: { ZIP: 37024, $or: [ { ADULTS_F_18_24: "Y" }, { ADULTS_F_24_35: "Y" } ] } } planSummary: IXSCAN { ZIP: 1.0, GENDER: 1.0 } keyUpdates:0 writeConflicts:0 numYields:88 reslen:44 locks:{ Global: { acquireCount: { r: 178 } }, MMAPV1Journal: { acquireCount: { r: 172 } }, Database: { acquireCount: { r: 89 } }, Collection: { acquireCount: { R: 89 }, acquireWaitCount: { R: 83 }, timeAcquiringMicros: { R: 1654781 } } } 6114ms 

Hi, please look through the logs to understand my question ... 2 requests, following the same plan .. have a big difference in execution time ... Please tell me the reason and how to fix it.

The following information should be convenient. I am working on this application on a Macintosh system. OSX Yosemite 10.10.2 Processor 3.2 GHz Intel Core i5. The memory is 8 GB 1600 MHz DDR3. Any suggestions how can I allocate more virtual memory for mongodb

+7
mongodb
source share
1 answer

As @Martin said, you need a profile. Use something like cursor.explain to make sure the query uses indexes and finds weaknesses. Use any resource monitor your system has (for example, top / htop on linux) to find out if it has run out of memory or if it is connected to the processor.

"Queries are run one after another" - I assume that you are not using async.series or similar, which is sequential.

0
source share

All Articles