-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.12.3
-
Component/s: Performance
-
None
-
Environment:RedHat server windows client
We are using Spring Data with the MongoDB Java driver.
We create an aggregation using AggregationOptions.OutputMode.CURSOR
There are 2 fields in the projection on a collection with almost 800K documents.
The aggregation does not use a sort or group; only a match and projection.
The aggregation matches on a single String value that is indexed.
The expected result set is all of the documents except 2 (over 700K).
The DBCursor.next() method seems very slow. I've tried a smaller data set with OutputMode.INLINE and the next method is much faster.
Here is the entire loop:
while (cursor.hasNext()) {
DBObject obj = cursor.next();
logger.warn("count=" + count++);
if (count % 10000 == 0)
}
Here are some timing from the logs:
14 Nov 2014 14:44:56,328 WARN : TestDistributionFilter,207 - count=6133
14 Nov 2014 14:44:56,418 WARN : TestDistributionFilter,207 - count=6134
14 Nov 2014 14:44:56,508 WARN : TestDistributionFilter,207 - count=6135
14 Nov 2014 14:44:56,597 WARN : TestDistributionFilter,207 - count=6136
14 Nov 2014 14:44:56,686 WARN : TestDistributionFilter,207 - count=6137
14 Nov 2014 14:44:56,776 WARN : TestDistributionFilter,207 - count=6138
It seems odd that it is taking almost 100 milisecs to pull back a single record from the server. I've commented out the record logging but that did not help much.
What can we do to speed it up?
Thanks,
gozer